You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need validateResponse to throw an error for invalid responses, if no responseValidationFn is passed.
res.set('Content-Type', ''); // Reset content-type since it is no longer valid
}
err.failedValidation = true;
err.message = 'Value expected to be an array/object but is not';
if (options.responseValidationFn) {
options.responseValidationFn(req, data, [err]);
sendData(res, data, encoding);
return;
}
const resultError = {
message: `Response schema validation failed for ${req.method}${req.originalUrl}`,
};
if (options.returnResponseErrors) {
err.errors = [{ message: 'Invalid response format' }];
}
next(resultError);
return;```
Need this to behave like validateRequest, where if there's no `options.requestValidationFn` and the request is invalid, the method sends 400 status with the error.
The text was updated successfully, but these errors were encountered:
Need
validateResponse
to throw an error for invalid responses, if noresponseValidationFn
is passed.The text was updated successfully, but these errors were encountered: