mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-29 15:56:06 +00: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 a new issue