Skip to content

Commit

Permalink
refactor: imporve the return type for shouldParseBodyAs method
Browse files Browse the repository at this point in the history
  • Loading branch information
3imed-jaberi committed Apr 10, 2023
1 parent 0c47e19 commit bb3e682
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/body-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function bodyParserWrapper(opts: BodyParserOptions = {}) {
*/
async function parseBody(ctx: Koa.Context) {
const shouldParseBodyAs = (type: BodyType) =>
isEnabledBodyAs[type] && ctx.request.is(mimeTypes[type]);
Boolean(isEnabledBodyAs[type] && ctx.request.is(mimeTypes[type]));
const bodyType =
detectJSON?.(ctx) || shouldParseBodyAs('json')
? 'json'
Expand Down

0 comments on commit bb3e682

Please sign in to comment.