Skip to content

Commit 1642a76

Browse files
committed
enhance(server): remove unnecessary workaround for Bun
1 parent fdde2cb commit 1642a76

File tree

4 files changed

+5
-47
lines changed

4 files changed

+5
-47
lines changed

.changeset/empty-plums-like.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@whatwg-node/server': patch
3+
---
4+
5+
Remove unnecessary workaround for Bun

.github/workflows/benchmarks.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
steps:
2626
- name: Checkout Repository
2727
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
28-
- name: Install Required Libraries
29-
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
3028
- name: Setup env
3129
uses: the-guild-org/shared-config/setup@main
3230
with:
@@ -69,8 +67,6 @@ jobs:
6967
steps:
7068
- name: Checkout Repository
7169
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
72-
- name: Install Required Libraries
73-
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
7470
- name: Setup env
7571
uses: the-guild-org/shared-config/setup@main
7672
with:

.github/workflows/tests.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ jobs:
108108
steps:
109109
- name: Checkout Master
110110
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
111-
- name: Install Required Libraries
112-
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
113111
- name: Setup env
114112
uses: the-guild-org/shared-config/setup@main
115113
with:
@@ -128,8 +126,6 @@ jobs:
128126
steps:
129127
- name: Checkout Master
130128
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
131-
- name: Install Required Libraries
132-
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
133129
- name: Setup env
134130
uses: the-guild-org/shared-config/setup@main
135131
with:
@@ -194,9 +190,6 @@ jobs:
194190
with:
195191
node-version: 24
196192

197-
- name: Install Required Libraries
198-
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev libssl-dev
199-
200193
- name: Cache Node Modules
201194
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
202195
id: node-modules-cache-deployment-e2e

packages/server/src/utils.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -183,42 +183,6 @@ export function normalizeNodeRequest(
183183
});
184184
}
185185

186-
// Workaround for Bun
187-
if (globalThis.Bun && fetchAPI.Request === globalThis.Request && isAsyncIterable(rawRequest)) {
188-
let iterator: AsyncIterator<Uint8Array>;
189-
return new fetchAPI.Request(fullUrl, {
190-
method: nodeRequest.method,
191-
headers: normalizedHeaders,
192-
signal: controller.signal,
193-
body: new ReadableStream({
194-
start() {
195-
iterator ||= rawRequest[Symbol.asyncIterator]();
196-
},
197-
pull(controller) {
198-
iterator ||= rawRequest[Symbol.asyncIterator]();
199-
return iterator
200-
.next()
201-
.then(({ done, value }) => {
202-
if (done) {
203-
controller.close();
204-
return;
205-
}
206-
controller.enqueue(value);
207-
})
208-
.catch(err => {
209-
controller.error(err);
210-
});
211-
},
212-
cancel(reason) {
213-
iterator ||= rawRequest[Symbol.asyncIterator]();
214-
return iterator.return?.(reason) as Promise<any>;
215-
},
216-
}),
217-
// @ts-expect-error - AsyncIterable is supported as body
218-
duplex: 'half',
219-
});
220-
}
221-
222186
// perf: instead of spreading the object, we can just pass it as is and it performs better
223187
return new fetchAPI.Request(fullUrl, {
224188
method: nodeRequest.method,

0 commit comments

Comments
 (0)