Skip to content

Commit

Permalink
fix some bugs that download response instead of showing result gin-co…
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafasolati committed Apr 4, 2017
1 parent 6743ec8 commit fd7aa3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"time"

"github.com/gin-contrib/gzip"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin.v1"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion gzip.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func Gzip(level int) gin.HandlerFunc {
gz.Reset(c.Writer)

c.Header("Content-Encoding", "gzip")
c.Header("Content-Type", "text/html; charset=UTF-8")
c.Header("Vary", "Accept-Encoding")
c.Writer = &gzipWriter{c.Writer, gz}
defer func() {
Expand Down Expand Up @@ -70,7 +71,7 @@ func shouldCompress(req *http.Request) bool {
}

switch extension {
case ".png", ".gif", ".jpeg", ".jpg":
case ".png", ".gif", ".jpeg", ".jpg", ".css", ".js":
return false
default:
return true
Expand Down

0 comments on commit fd7aa3c

Please sign in to comment.