This commit is contained in:
Rizky 2024-02-07 18:16:28 +07:00
parent 277dc28703
commit 6f93fe2cc7
1 changed files with 3 additions and 2 deletions

View File

@ -68,15 +68,16 @@ export const fetchViaProxy = async (
data instanceof File || data instanceof File ||
(Array.isArray(data) && data[0] instanceof File) (Array.isArray(data) && data[0] instanceof File)
) { ) {
const target = new URL(url);
if (data instanceof File) { if (data instanceof File) {
const res = await fetch(url, { const res = await fetch(target.pathname, {
body: data, body: data,
method: "POST", method: "POST",
headers: _headers, headers: _headers,
}); });
return await res.text(); return await res.text();
} else { } else {
const res = await fetch(url, { const res = await fetch(target.pathname, {
body: data[0], body: data[0],
method: "POST", method: "POST",
headers: _headers, headers: _headers,