Skip to content

Commit 519ef87

Browse files
update: disable hacky fix for bun
now it no longer will enforce uncompressed responses
1 parent 3f98a34 commit 519ef87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,21 @@ function sendResponse(req, res, data, status, trace = false) {
301301
const buffer = Buffer.from(jsonData)
302302
const encoding = req.headers['accept-encoding'] || ''
303303

304+
305+
/*
306+
// https://bun.com/blog/bun-v1.3.3
304307
if (process.isBun) {
305308
headers['Content-Length'] = buffer.byteLength
306309
res.writeHead(status, headers)
307310
res.end(buffer)
308311
return
309-
}
312+
} */
310313
const compressions = [
311314
{ type: 'br', method: zlib.brotliCompress },
312315
{ type: 'gzip', method: zlib.gzip },
313316
{ type: 'deflate', method: zlib.deflate }
314317
]
315-
if (process.versions.node >= '22.0.0') {
318+
if (process.versions.node >= '22.0.0' || process.isBun) {
316319
compressions.unshift({ type: 'zstd', method: zlib.zstdCompress })
317320
}
318321

0 commit comments

Comments
 (0)