Skip to content

Commit

Permalink
fix: use startswith for content type
Browse files Browse the repository at this point in the history
  • Loading branch information
Hebilicious committed Jul 20, 2023
1 parent 34c8373 commit 0093b51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export async function readBodySafe<TSchema extends Schema<unknown>>(
return (event.node.req as any)[ParsedBodySymbol] as Infer<typeof schema>;
}
const contentType = getRequestHeader(event, "content-type");
if (contentType === "application/x-www-form-urlencoded") {
if (contentType?.startsWith("application/x-www-form-urlencoded")) {
const formPayload = Object.fromEntries(await readFormData(event));
const result = await assertSchema(schema, formPayload, onError);
(event.node.req as any)[ParsedBodySymbol] = result;
Expand Down

0 comments on commit 0093b51

Please sign in to comment.