mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 14:20:01 -04:00
WORKING
This commit is contained in:
parent
bcaf437fd3
commit
e398dc2bc6
3 changed files with 30 additions and 14 deletions
|
@ -37,7 +37,7 @@ export class AdriftBareClient extends Client {
|
|||
console.log({ body });
|
||||
throw new Error("bare-client-custom passed an unexpected body type");
|
||||
}
|
||||
let rawResponse = await this.connection.httprequest({
|
||||
let { payload, body: respBody } = await this.connection.httprequest({
|
||||
method,
|
||||
requestHeaders,
|
||||
body,
|
||||
|
@ -45,8 +45,18 @@ export class AdriftBareClient extends Client {
|
|||
cache,
|
||||
duplex,
|
||||
});
|
||||
const headers = new Headers();
|
||||
for (const [header, values] of Object.entries(payload.headers)) {
|
||||
for (const value of values) {
|
||||
headers.append(header, value);
|
||||
}
|
||||
}
|
||||
|
||||
return new Response(JSON.stringify(rawResponse)) as BareResponse;
|
||||
return new Response(respBody, {
|
||||
status: payload.status,
|
||||
statusText: payload.statusText,
|
||||
headers,
|
||||
}) as BareResponse;
|
||||
}
|
||||
connect(
|
||||
remote: URL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue