Skip to content

Commit 2dedfcc

Browse files
committed
fix: number issue in parseRequestBody
1 parent e831cf1 commit 2dedfcc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/body.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { HttpMethod } from "~/types/http";
22
import type { FixedRequest } from "~/types/request";
33
import { resolveContent } from "./content";
4+
import { safeParse } from "./zod-error-handler";
45
import type { RequestBodyObject } from "@omer-x/openapi-types/request-body";
56
import type { ZodError, ZodType, ZodTypeDef } from "zod";
67

@@ -27,7 +28,7 @@ export async function parseRequestBody<I, O>(
2728
...collection, [key]: formData.get(key),
2829
}), {});
2930
try {
30-
return schema.parse(body);
31+
return safeParse(schema, body);
3132
} catch (error) {
3233
if (process.env.NODE_ENV !== "production") {
3334
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)