mr feedback

This commit is contained in:
Jorrin 2024-01-25 19:37:15 +01:00
parent ad8c6709a1
commit b5cd297ad8

View file

@ -6,17 +6,12 @@ export function getBodyTypeFromBody(
if (typeof body === "string") return "string";
if (body instanceof FormData) return "FormData";
if (body instanceof URLSearchParams) return "URLSearchParams";
if (typeof body === "object") return "object";
return undefined;
return "object";
}
export function convertBodyToObject(body: unknown): any {
if (body instanceof FormData || body instanceof URLSearchParams) {
const obj: Record<string, any> = {};
for (const [key, value] of body.entries()) {
obj[key] = value;
}
return obj;
return [...body];
}
return body;
}