mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-28 15:51:50 +01:00
mr feedback
This commit is contained in:
parent
ad8c6709a1
commit
b5cd297ad8
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user