Attempting to use this results in gzipped files downloading
So when using this it constantly results in my browser downloading a gzipped file. I also get a panic from Martini saying the following:
[martini] PANIC: interface conversion: *martini.responseWriter is not martini.ResponseWriter: missing method Before
My code is as follows:
m := martini.Classic()
m.Use(gzip.All())
m.Use(render.Renderer())
m.Get("/", func() string {
return "Test"
})
@JaTochNietDan The symptom you're describing typically happens when there's an error in a handler/middleware outside of gzip's control. I'll double check this to ensure it's still correct as soon as I can.
I just ran into this and fixed it by clearing out my imports for martini, codegangsta and martini-contrib and then doing a fresh go get
I wasn't having the PANIC error that @JaTochNietDan was having, but I am getting gzipped files downloading as well. It's only happening when I a) use gzip, and b) return a status code.
// If I comment this out or remove it, it works perfectly.
m.Use(gzip.All())
m.Group("/x/y/z", func(r martini.Router) {
r.Get("", SomeFunc)
})
func SomeFunc(req *http.Request, params martini.Params) (int, string) {
...
return 200, "something"
}