Skip to content

Commit

Permalink
refactor: refactor codebase to improve maintainability and performance
Browse files Browse the repository at this point in the history
- Replace hardcoded "Accept-Encoding" header string with a constant `headerAcceptEncoding`

Signed-off-by: appleboy <[email protected]>
  • Loading branch information
appleboy committed Jan 13, 2025
1 parent 262eca6 commit 79e888f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (g *gzipHandler) Handle(c *gin.Context) {
}

func (g *gzipHandler) shouldCompress(req *http.Request) bool {
if !strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") ||
if !strings.Contains(req.Header.Get(headerAcceptEncoding), "gzip") ||
strings.Contains(req.Header.Get("Connection"), "Upgrade") {
return false
}
Expand Down

0 comments on commit 79e888f

Please sign in to comment.