From 22de5928a3ecbcc097a359acd15c405a70bc2585 Mon Sep 17 00:00:00 2001 From: Jacques Yakoub Date: Mon, 2 Dec 2019 22:13:26 +0100 Subject: [PATCH] Update openapi.multipart.ts Add global namespace for typing https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18569#issuecomment-319669945 --- src/middlewares/openapi.multipart.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middlewares/openapi.multipart.ts b/src/middlewares/openapi.multipart.ts index e8ed7b5f..a0f7465e 100644 --- a/src/middlewares/openapi.multipart.ts +++ b/src/middlewares/openapi.multipart.ts @@ -74,7 +74,7 @@ function error(req: OpenApiRequest, err: Error): ValidationError { // - 413 ( Request Entity Too Large ) : Too many parts / File too large / Too many files // - 400 ( Bad Request ) : Field * too long / Too many fields // - 500 ( Internal Server Error ) : Unexpected field - const multerError: multer.MulterError = err; + const multerError: Express.Multer.MulterError = err; const payload_too_big = /LIMIT_(FILE|PART)_(SIZE|COUNT)/.test(multerError.code); const unexpected = /LIMIT_UNEXPECTED_FILE/.test(multerError.code); const status = (payload_too_big) @@ -82,7 +82,7 @@ function error(req: OpenApiRequest, err: Error): ValidationError { : (!unexpected) ? 400 : 500; - return validationError(500, req.path, err.message); + return validationError(status, req.path, err.message); } else { // HACK // TODO improve multer error handling