mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(core): allow non-json body type when parsing (#6379)
This commit is contained in:
parent
b91ec0cd6f
commit
323a5650f0
1 changed files with 3 additions and 3 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue