gravityblast/traffic

Can't set Header on NotFoundHandler

baldrailers opened this issue · 6 comments

I'm trying to override the content-type for the NotFoundHandler to be in Content-Type: application/json; charset=utf-8 but it seems like its still using Content-Type: text/plain even with beforeFilter setup.

can you post a gist with an example just to try it please?

thank you very much! you are right. That's because Traffic sets the 404 header when it doesn't find a handler for the current request, and after writing the header you can't write other headers. I have a quick solution but I want to test it more, I'll try to push a fix ASAP!

@pilu sounds great man. Keep them coming!

@pilu any word on this? thanks

@baldrailers the issue should be fixed now. The router doesn't write the 404 status anymore if a custom not found handler is defined. You should write the 404 status in your custom handler.