mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
fix(http): response with status code 204 (#960)
* Fix response construction with status code 204 * run pnpm build
This commit is contained in:
@@ -155,15 +155,25 @@ export async function fetch(
|
||||
rid,
|
||||
});
|
||||
|
||||
const body = await invoke<number[]>("plugin:http|fetch_read_body", {
|
||||
rid: responseRid,
|
||||
});
|
||||
const body = await invoke<ArrayBuffer | number[]>(
|
||||
"plugin:http|fetch_read_body",
|
||||
{
|
||||
rid: responseRid,
|
||||
},
|
||||
);
|
||||
|
||||
const res = new Response(new Uint8Array(body), {
|
||||
headers,
|
||||
status,
|
||||
statusText,
|
||||
});
|
||||
const res = new Response(
|
||||
body instanceof ArrayBuffer && body.byteLength
|
||||
? body
|
||||
: body instanceof Array && body.length
|
||||
? new Uint8Array(body)
|
||||
: null,
|
||||
{
|
||||
headers,
|
||||
status,
|
||||
statusText,
|
||||
},
|
||||
);
|
||||
|
||||
// url is read only but seems like we can do this
|
||||
Object.defineProperty(res, "url", { value: url });
|
||||
|
||||
Reference in New Issue
Block a user