Closed GoogleCodeExporter closed 9 years ago
actually i think this should be done in the http package proper.
The better change to make for Gorilla, I think, is to make it a NotFoundRouter.
That way, you could have different 404 pages for different criteria. The main
one I can think of is custom 404 pages for subdomains. Think, code.google.com
vs google.com vs mail.google.com (although google seems to have consolidated).
Although, its probably overkill.
Much easier solution would be to have a per-Router NotFoundHandler variable
that defaults to http.NotFoundHandler if its nil.
Original comment by balasan...@gmail.com
on 7 Sep 2011 at 6:10
Sorry, I only saw these issues now.
The current NotFoundHandler is hardcoded, and the general idea was that if you
needed a custom one, you should reimplement ServeHTTP (which has only 10-15
lines). This was the fastest solution and forced me to ensure that there was an
API for custom implementations.
But yeah, it works as it is but this could be more convenient. I think it will
be pretty simple to support registering a custom NotFoundHandler in the router
and use it, like you suggest.
I want to implement this but if you provide a patch it'll be awesome! :) I'm
currently finishing the sessions package, which needs lots of tests and docs.
Thanks for the feedback.
Original comment by rodrigo.moraes
on 8 Sep 2011 at 3:45
Original comment by rodrigo.moraes
on 13 Sep 2011 at 4:04
This issue was closed by revision 9a16a110c4ca.
Original comment by rodrigo.moraes
on 25 Sep 2011 at 7:06
Original issue reported on code.google.com by
balasan...@gmail.com
on 7 Sep 2011 at 6:02Attachments: