mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 23:00:01 -04:00
fix: make raw response return transferrable response
This commit is contained in:
parent
4b7607b4a7
commit
7585f3e3c7
1 changed files with 3 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { BareHeaders, BareTransport, maxRedirects } from './baretypes';
|
import { BareHeaders, BareTransport, maxRedirects, TransferrableResponse } from './baretypes';
|
||||||
import { WorkerConnection, WorkerMessage } from './connection';
|
import { WorkerConnection, WorkerMessage } from './connection';
|
||||||
import { nativeFetch } from './snapshot';
|
import { nativeFetch } from './snapshot';
|
||||||
import { BareWebSocket } from './websocket';
|
import { BareWebSocket } from './websocket';
|
||||||
|
@ -27,7 +27,7 @@ const statusRedirect = [301, 302, 303, 307, 308];
|
||||||
* A Response with additional properties.
|
* A Response with additional properties.
|
||||||
*/
|
*/
|
||||||
export interface BareResponse extends Response {
|
export interface BareResponse extends Response {
|
||||||
rawResponse: Response;
|
rawResponse: TransferrableResponse;
|
||||||
rawHeaders: BareHeaders;
|
rawHeaders: BareHeaders;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +179,6 @@ export class BareClient {
|
||||||
);
|
);
|
||||||
|
|
||||||
result.rawHeaders = Object.fromEntries(response.headers as any);
|
result.rawHeaders = Object.fromEntries(response.headers as any);
|
||||||
result.rawResponse = response;
|
|
||||||
|
|
||||||
return result as BareResponseFetch;
|
return result as BareResponseFetch;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +201,7 @@ export class BareClient {
|
||||||
statusText: resp.statusText,
|
statusText: resp.statusText,
|
||||||
}) as BareResponse;
|
}) as BareResponse;
|
||||||
responseobj.rawHeaders = resp.headers;
|
responseobj.rawHeaders = resp.headers;
|
||||||
|
responseobj.rawResponse = resp;
|
||||||
responseobj.finalURL = urlO.toString();
|
responseobj.finalURL = urlO.toString();
|
||||||
|
|
||||||
const redirect = init?.redirect || req.redirect;
|
const redirect = init?.redirect || req.redirect;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue