RequestHeader type edge cases
Opened this issue · 1 comments
The way the RequestHeader
type is built brings up some possibly undefined edge cases. For example, this returns false
:
ContentType applicationJSON == RequestHeader "Content-Type" "application/json"
And are these the same?
affjax $ defaultRequest { headers = [ ContentType applicationJSON ] }
affjax $ defaultRequest { headers = [ RequestHeader "Content-Type" "application/json" ] }
Yeah, this is a known thing, but something I haven't gotten around to sorting out. The HTTP headers shouldn't even be managed by this project really, I did start a more comprehensive version in contrib
: https://github.com/purescript-contrib/purescript-http-headers but it needs plenty of work too.
Being able to pattern match on the headers is quite useful, so hiding the constructor and just providing a smart constructor that will ensure that the types are canonicalised isn't ideal, so maybe we either need to provide a canoncialiseHeader
function, or perhaps a CanoncialHeader
type that can be matched on or something like that.