Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): allow non-json body type when parsing #6379

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/core/src/oidc/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
// Temporarily removed 'EdDSA' since it's not supported by browser yet
const supportedSigningAlgs = Object.freeze(['RS256', 'PS256', 'ES256', 'ES384', 'ES512'] as const);

export default function initOidc(

Check warning on line 61 in packages/core/src/oidc/init.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/core/src/oidc/init.ts#L61

[max-params] Function 'initOidc' has too many parameters (5). Maximum allowed is 4.
envSet: EnvSet,
queries: Queries,
libraries: Libraries,
Expand Down Expand Up @@ -400,10 +400,10 @@
// '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);

Check warning on line 404 in packages/core/src/oidc/init.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/oidc/init.ts#L403-L404

Added lines #L403 - L404 were not covered by tests
} else if (ctx.is(formUrlEncodedContentType)) {
ctx.request.body = querystring.parse(body);
ctx.request.body = trySafe(() => querystring.parse(body));

Check warning on line 406 in packages/core/src/oidc/init.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/oidc/init.ts#L406

Added line #L406 was not covered by tests
}
}

Expand Down
Loading