Fix message validation for request responses

Fix the validation loging for sending responses to requests not
functioning due to the message data property being passed incorrectly to
the validator.
This commit is contained in:
Hornwitser committed 2020-12-28 07:03:32 +01:00
1 parent 6eef4bd300
commit e8405cbf77
2 files changed
+25 -3

No files matched your search

+3 -2
View File
@@ -207,12 +207,13 @@ class Request extends Message {
response = {};
}
if (!this._responseValidator({ seq: 0, type: this.responseType, response })) {
let data = { ...response, seq: message.seq };
if (!this._responseValidator({ seq: 0, type: this.responseType, data })) {
logger.error(JSON.stringify(this._responseValidator.errors, null, 4));
throw new Error(`Validation failed responding to ${this.requestType}`);
}
link.connector.send(this.responseType, { ...response, seq: message.seq });
link.connector.send(this.responseType, data);
}).catch(err => {
if (!(err instanceof libErrors.RequestError)) {