From a4dffc6527f412d51a786ae5bf2e9080fe1ca63c Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Sun, 4 Jul 2021 00:39:46 +0200 Subject: [PATCH] fix: remove x-sourcemap header This header is useless, as the client bundle already contains a sourceMappingURL field. Besides, Firefox prints the following warning: > is being assigned a //# sourceMappingURL, but already has one Related: https://github.com/socketio/socket.io/issues/3958 --- lib/index.ts | 3 --- test/socket.io.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 53aad1188f..6f9f882ad6 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -515,9 +515,6 @@ export class Server< ); res.setHeader("ETag", expectedEtag); - if (!isMap) { - res.setHeader("X-SourceMap", filename.substring(1) + ".map"); - } Server.sendFile(filename, req, res); } diff --git a/test/socket.io.ts b/test/socket.io.ts index 206cf1d783..87c36693fb 100644 --- a/test/socket.io.ts +++ b/test/socket.io.ts @@ -59,7 +59,7 @@ describe("socket.io", () => { if (err) return done(err); expect(res.headers["content-type"]).to.be("application/javascript"); expect(res.headers.etag).to.be('"' + clientVersion + '"'); - expect(res.headers["x-sourcemap"]).to.be(filename + ".map"); + expect(res.headers["x-sourcemap"]).to.be(undefined); expect(res.text).to.match(/engine\.io/); expect(res.status).to.be(200); done();