Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to use this results in gzipped files downloading #7

Open
JaTochNietDan opened this issue Jun 3, 2014 · 3 comments
Open

Comments

@JaTochNietDan
Copy link

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"
})
@slogsdon
Copy link
Member

slogsdon commented Jun 6, 2014

@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.

@Bochenski
Copy link

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

@lukevers
Copy link

lukevers commented May 4, 2015

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"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants