Skip to content

Commit

Permalink
fix: remove duplicate pipeline when serving bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Feb 12, 2024
1 parent e36062c commit cd27e4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/index.ts
Expand Up @@ -625,7 +625,6 @@ export class Server<
switch (encoding) {
case "br":
res.writeHead(200, { "content-encoding": "br" });
readStream.pipe(createBrotliCompress()).pipe(res);
pipeline(readStream, createBrotliCompress(), res, onError);
break;
case "gzip":
Expand Down
15 changes: 15 additions & 0 deletions test/server-attachment.ts
Expand Up @@ -70,6 +70,21 @@ describe("server attachment", () => {
});
});

it("should serve client (br)", (done) => {
const srv = createServer();
new Server(srv);
request(srv)
.get("/socket.io/socket.io.js")
.set("accept-encoding", "br")
.buffer(true)
.end((err, res) => {
if (err) return done(err);
expect(res.headers["content-encoding"]).to.be("br");
expect(res.status).to.be(200);
done();
});
});

it("should serve client with necessary CORS headers", (done) => {
const srv = createServer();
new Server(srv, {
Expand Down

0 comments on commit cd27e4c

Please sign in to comment.