Skip to content

Commit e426f3e

Browse files
fix: remove duplicate pipeline when serving bundle
Related: #4946
1 parent e36062c commit e426f3e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ export class Server<
625625
switch (encoding) {
626626
case "br":
627627
res.writeHead(200, { "content-encoding": "br" });
628-
readStream.pipe(createBrotliCompress()).pipe(res);
629628
pipeline(readStream, createBrotliCompress(), res, onError);
630629
break;
631630
case "gzip":

test/server-attachment.ts

+15
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ describe("server attachment", () => {
7070
});
7171
});
7272

73+
it("should serve client (br)", (done) => {
74+
const srv = createServer();
75+
new Server(srv);
76+
request(srv)
77+
.get("/socket.io/socket.io.js")
78+
.set("accept-encoding", "br")
79+
.buffer(true)
80+
.end((err, res) => {
81+
if (err) return done(err);
82+
expect(res.headers["content-encoding"]).to.be("br");
83+
expect(res.status).to.be(200);
84+
done();
85+
});
86+
});
87+
7388
it("should serve client with necessary CORS headers", (done) => {
7489
const srv = createServer();
7590
new Server(srv, {

0 commit comments

Comments
 (0)