|
|
|
@ -102,7 +102,7 @@ export interface ClientOptions {
|
|
|
|
|
*/
|
|
|
|
|
export async function fetch(
|
|
|
|
|
input: URL | Request | string,
|
|
|
|
|
init?: RequestInit & ClientOptions
|
|
|
|
|
init?: RequestInit & ClientOptions,
|
|
|
|
|
): Promise<Response> {
|
|
|
|
|
const maxRedirections = init?.maxRedirections;
|
|
|
|
|
const connectTimeout = init?.connectTimeout;
|
|
|
|
@ -150,7 +150,7 @@ export async function fetch(
|
|
|
|
|
// we need to ensure we have all header values as strings
|
|
|
|
|
// eslint-disable-next-line
|
|
|
|
|
typeof val === "string" ? val : (val as any).toString(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const rid = await invoke<number>("plugin:http|fetch", {
|
|
|
|
@ -193,7 +193,7 @@ export async function fetch(
|
|
|
|
|
"plugin:http|fetch_read_body",
|
|
|
|
|
{
|
|
|
|
|
rid: responseRid,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const res = new Response(
|
|
|
|
@ -206,7 +206,7 @@ export async function fetch(
|
|
|
|
|
headers: responseHeaders,
|
|
|
|
|
status,
|
|
|
|
|
statusText,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// url is read only but seems like we can do this
|
|
|
|
|