Defer setHeader/*
ngryman opened this issue · comments
Nicolas Gryman commented
Because other middlewares can generate dynamic content w/ an appropriate content-type
but with a custom url, we should defer setting other headers by subscribing to the .on('header', ...)
event.
We should continue relying on the given content-type
to apply cache and other stuff.
By defering, we also ensure that we have the last word and that nobody will override what we set.
By providing dynamic content, the user takes the responsability to match the correct content-type
correctly.
If nobody sets the content-type
it should be defaulted to application/octet-stream
(the current behavior).
Nicolas Gryman commented
Done in decdd0f