Skip to content

Commit b1f7623

Browse files
committed
refactor(/serverHandler/page): call defer ASAP
1 parent 2a3553f commit b1f7623

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/serverHandler/page.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ func (h *handler) page(w http.ResponseWriter, r *http.Request, data *responseDat
8080

8181
var bodyW io.Writer
8282
if compressW, encoding, useCompressW := getCompressWriter(w, r); useCompressW {
83+
defer compressW.Close()
8384
header.Set("Content-Encoding", encoding)
8485
bodyW = compressW
85-
defer compressW.Close()
8686
} else {
8787
bodyW = w
8888
}

0 commit comments

Comments
 (0)