silkapp / rest

Packages for defining APIs, running them, generating client code and documentation.
http://silkapp.github.io/rest
390 stars 52 forks source link

HTTP headers ought to be treated as case insensitive #71

Closed tathougies closed 9 years ago

tathougies commented 9 years ago

rest currently parses HTTP headers as case sensitive. The HTTP standard says that they ought to be treated case insensitive. This is especially a problem because the Node.js javascript generated by rest-gen sends the header "Content-type" for POST requests and Rest.Driver.Perform calls getHeader "Content-Type". This means that the Javascript client library generated by rest-gen doesn't actually work with the API when serving the API via WAI and Warp.

This may not affect the Happstack and Snap backends because they call the underlying server's getHeader function which treats header names correctly.

One solution would be to change the type of RestInput.headers to HashMap (CI String) String in Rest.Driver.RestM

hesselink commented 9 years ago

Yes, this is a known bug (in fact it's a duplicate of #8, which I'm closing because this one has more info). Your solution sounds good, pull requests are welcome!

pikeas commented 9 years ago

If pull request #72 was merged, why is this issue still open?

hesselink commented 9 years ago

Because we didn't close it? ;) Thanks for drawing our attention to it.