Skip to content

Commit

Permalink
fix(core): allow non-json body type when parsing (#6379)
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-sun authored Aug 1, 2024
1 parent b91ec0c commit 323a565
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/oidc/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,10 @@ export default function initOidc(
// 'application/json' for body parsing. Update relatively when we enable that feature.
if (ctx.is(jsonContentType)) {
ctx.headers['content-type'] = formUrlEncodedContentType;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
ctx.request.body = JSON.parse(body);
// eslint-disable-next-line no-restricted-syntax
ctx.request.body = trySafe(() => JSON.parse(body) as unknown);
} else if (ctx.is(formUrlEncodedContentType)) {
ctx.request.body = querystring.parse(body);
ctx.request.body = trySafe(() => querystring.parse(body));
}
}

Expand Down

0 comments on commit 323a565

Please sign in to comment.