We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 79e888f commit 3830b8fCopy full SHA for 3830b8f
handler.go
@@ -2,10 +2,10 @@ package gzip
2
3
import (
4
"compress/gzip"
5
- "fmt"
6
"io"
7
"net/http"
8
"path/filepath"
+ "strconv"
9
"strings"
10
"sync"
11
@@ -92,8 +92,10 @@ func (g *gzipHandler) Handle(c *gin.Context) {
92
// do not write gzip footer when nothing is written to the response body
93
gz.Reset(io.Discard)
94
}
95
- gz.Close()
96
- c.Header("Content-Length", fmt.Sprint(c.Writer.Size()))
+ _ = gz.Close()
+ if c.Writer.Size() > -1 {
97
+ c.Header("Content-Length", strconv.Itoa(c.Writer.Size()))
98
+ }
99
}()
100
c.Next()
101
0 commit comments