nytimes / gziphandler

Go middleware to gzip HTTP responses
https://godoc.org/github.com/NYTimes/gziphandler
Apache License 2.0
868 stars 129 forks source link

How do you implement this in a Gin server? #57

Closed Programmerino closed 6 years ago

jprobinson commented 6 years ago

Hi there, @SkyrisBactera!

I haven't tried it myself, but it looks like folks have created a tool that may allows users to hook in an http.Handler middleware: https://github.com/turtlemonvh/gin-wraphh

Check here for more info: https://github.com/gin-gonic/gin/issues/293

I hope this helps. If not, please create an issue with the gin project.

Programmerino commented 6 years ago

Thank you for such a quick response! I'll try it out! Thanks!

Programmerino commented 6 years ago

For anybody else looking at this, you want to use

router.Use(wraphh.WrapHH(gziphandler.GzipHandler))

after importing

"github.com/turtlemonvh/gin-wraphh"