util.go 333 B

1234567891011121314151617181920
  1. package middleware
  2. import (
  3. "strings"
  4. "github.com/Unknwon/macaron"
  5. )
  6. func Gziper() macaron.Handler {
  7. macaronGziper := macaron.Gziper()
  8. return func(ctx *macaron.Context) {
  9. requestPath := ctx.Req.URL.RequestURI()
  10. if strings.HasPrefix(requestPath, "/api/datasources/proxy") {
  11. return
  12. }
  13. ctx.Invoke(macaronGziper)
  14. }
  15. }