Skip to content

Commit 00ce2e8

Browse files
committed
Include review suggestions
Signed-off-by: Manuel Rüger <[email protected]>
1 parent 140db7a commit 00ce2e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

prometheus/promhttp/http.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ const (
5555
processStartTimeHeader = "Process-Start-Time-Unix"
5656
)
5757

58+
// Compression represents the content encodings handlers support for the HTTP
59+
// responses.
5860
type Compression string
5961

6062
const (
@@ -427,7 +429,7 @@ func httpError(rsp http.ResponseWriter, err error) {
427429
)
428430
}
429431

430-
// NegotiateEncodingWriter reads the Accept-Encoding header from a request and
432+
// negotiateEncodingWriter reads the Accept-Encoding header from a request and
431433
// selects the right compression based on an allow-list of supported
432434
// compressions. It returns a writer implementing the compression and an the
433435
// correct value that the caller can set in the response header.
@@ -451,8 +453,6 @@ func negotiateEncodingWriter(r *http.Request, rw io.Writer, compressions []strin
451453
return z, selected, func() { _ = z.Close() }, nil
452454
case "gzip":
453455
gz := gzipPool.Get().(*gzip.Writer)
454-
defer gzipPool.Put(gz)
455-
456456
gz.Reset(rw)
457457
return gz, selected, func() { _ = gz.Close(); gzipPool.Put(gz) }, nil
458458
case "identity":

0 commit comments

Comments
 (0)