Skip to content

Commit 96d36c0

Browse files
authored
Revert "feat: fetch with keepalive (#618)" (#651)
1 parent a7a6fa2 commit 96d36c0

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

src/dispatch/FetchHttpHandler.ts

+26-27
Original file line numberDiff line numberDiff line change
@@ -88,38 +88,37 @@ export class FetchHttpHandler implements HttpHandler {
8888

8989
const fetchRequest = new Request(url, requestOptions);
9090
const raceOfPromises = [
91-
this.fetchFunction!.apply(window, [
92-
fetchRequest,
93-
{ keepalive: true }
94-
]).then((response) => {
95-
const fetchHeaders: any = response.headers;
96-
const transformedHeaders: HeaderBag = {};
97-
98-
for (const pair of fetchHeaders.entries() as string[][]) {
99-
transformedHeaders[pair[0]] = pair[1];
100-
}
101-
102-
const hasReadableStream = response.body !== undefined;
103-
104-
// Return the response with buffered body
105-
if (!hasReadableStream) {
106-
return response.blob().then((body) => ({
91+
this.fetchFunction!.apply(window, [fetchRequest]).then(
92+
(response) => {
93+
const fetchHeaders: any = response.headers;
94+
const transformedHeaders: HeaderBag = {};
95+
96+
for (const pair of fetchHeaders.entries() as string[][]) {
97+
transformedHeaders[pair[0]] = pair[1];
98+
}
99+
100+
const hasReadableStream = response.body !== undefined;
101+
102+
// Return the response with buffered body
103+
if (!hasReadableStream) {
104+
return response.blob().then((body) => ({
105+
response: new HttpResponse({
106+
headers: transformedHeaders,
107+
statusCode: response.status,
108+
body
109+
})
110+
}));
111+
}
112+
// Return the response with streaming body
113+
return {
107114
response: new HttpResponse({
108115
headers: transformedHeaders,
109116
statusCode: response.status,
110-
body
117+
body: response.body
111118
})
112-
}));
119+
};
113120
}
114-
// Return the response with streaming body
115-
return {
116-
response: new HttpResponse({
117-
headers: transformedHeaders,
118-
statusCode: response.status,
119-
body: response.body
120-
})
121-
};
122-
}),
121+
),
123122
requestTimeout(requestTimeoutInMs)
124123
];
125124
if (abortSignal) {

0 commit comments

Comments
 (0)