Skip to content

Commit

Permalink
nsqadmin: fix js source-map serving for firefox
Browse files Browse the repository at this point in the history
The Content-Type of the source-map file is not supposed to matter.
But, if Content-Encoding is gzip, and Content-Type is x-gzip, then
Firefox does not decompress the response before trying to decode json,
and fails to load the source map for the debugger, complaining:
"unexpected character at line 1 column 1 of the JSON data".
With a proper Content-Type, Firefox decompresses and understands.
(Chrome works either way.)
  • Loading branch information
ploxiln committed Sep 21, 2019
1 parent 56fab34 commit 4d384b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nsqadmin/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ func (s *httpServer) staticAssetHandler(w http.ResponseWriter, req *http.Request
ct := mime.TypeByExtension(ext)
if ct == "" {
switch ext {
case ".map":
ct = "application/json"
case ".svg":
ct = "image/svg+xml"
case ".woff":
Expand Down

0 comments on commit 4d384b4

Please sign in to comment.