tsweb: fix JSONHandlerFunc regression where HTTP status was lost on gzip

Change-Id: Ia7add6cf7e8b46bb6dd45bd3c0371ea79402fb45
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2022-02-09 12:06:27 -08:00
committed by Brad Fitzpatrick
parent 62db629227
commit 24c9dbd129
2 changed files with 18 additions and 0 deletions

View File

@@ -100,6 +100,7 @@ func (fn JSONHandlerFunc) ServeHTTPReturn(w http.ResponseWriter, r *http.Request
}
w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Content-Length", strconv.Itoa(len(encb)))
w.WriteHeader(status)
w.Write(encb)
} else {
w.Header().Set("Content-Length", strconv.Itoa(len(b)))