Skip to content

Commit

Permalink
Fix req.path uniqueness in response validators caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalneves committed Nov 11, 2019
1 parent 562f861 commit 235c4db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middlewares/openapi.response.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 235c4db

Please sign in to comment.