diff --git a/src/middlewares/openapi.response.validator.ts b/src/middlewares/openapi.response.validator.ts index 7ad6cc63..fa9cd43b 100644 --- a/src/middlewares/openapi.response.validator.ts +++ b/src/middlewares/openapi.response.validator.ts @@ -31,7 +31,7 @@ export class ResponseValidator { const responses = req.openapi.schema && req.openapi.schema.responses; const validators = this._getOrBuildValidator(req, responses); const statusCode = res.statusCode; - const path = req.path; + const path = req.originalUrl; return this._validate({ validators, body, statusCode, path }); } return body; @@ -46,7 +46,7 @@ export class ResponseValidator { } const contentType = extractContentType(req) || 'not_provided'; - const key = `${req.method}-${req.path}-${contentType}`; + const key = `${req.method}-${req.originalUrl}-${contentType}`; let validators = this.validatorsCache[key]; if (!validators) {