Skip to content

Commit

Permalink
Forgot the typescript casting
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 authored Dec 2, 2019
1 parent aa67bc3 commit 1d5f572
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/middlewares/openapi.multipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ 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 payload_too_big = /LIMIT_(FILE|PART)_(SIZE|COUNT)/.test(err.code);
const unexpected = /LIMIT_UNEXPECTED_FILE/.test(err.code);
const multerError: 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)
? 413
: (!unexpected)
Expand Down

0 comments on commit 1d5f572

Please sign in to comment.