Ability to set extra headers for static files inside dispatch table #639

wants to merge 1 commit into


None yet

2 participants


A common example might be "Access-Control-Allow-Origin" if you want to do cross-domain static files querying.

Couple things I'm not sure of:

  1. Making extra_headers_provided/2's arity 2 looks more consistent when compared to other functions of the same kind (content_types_provided/2, charsets_provided/2 and such), but looks like an overkill at the same time (passing around unneeded values, while what we really need is the list of headers)

  2. Would you like to see some tests for this one, especially for the cases when we pass both {headers, ...} and {mimetypes, ...} options at the same time?

  3. I'm not sure that the way I chose for applying headers (extra_headers_provided -> content_types_provided -> the_rest) is actually the right one. It looks more logical (explicit content-type is more specific than an explicit headers list), but for someone it might sound less consistent than extra_headers_provided trumping all the other "headers" functions. Not sure why one would use both options at the same time though :)

Nine Nines member

You can use hooks or middlewares for this. And as a bonus it'll even work with more than just static handlers.


Sounds good, thanks!

@doubleyou doubleyou closed this Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment