extend/cowboy — pull request #639 by doubleyou (2013-12-15 05:08:56+00:00)
Title: Ability to set extra headers for static files inside dispatch table

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 :)