Skip to content

Commit

Permalink
improve path caching #242
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Feb 25, 2020
1 parent d2fd8a5 commit 0f4ddcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middlewares/openapi.request.validator.ts
Expand Up @@ -70,7 +70,8 @@ export class RequestValidator {
// cache middleware by combining method, path, and contentType
const contentType = ContentType.from(req);
const contentTypeKey = contentType.equivalents()[0] ?? 'not_provided';
const key = `${req.method}-${req.originalUrl}-${contentTypeKey}`;
// use openapi.expressRoute as path portion of key
const key = `${req.method}-${path}-${contentTypeKey}`;

if (!this.middlewareCache[key]) {
const middleware = this.buildMiddleware(path, reqSchema, contentType);
Expand Down

0 comments on commit 0f4ddcf

Please sign in to comment.