Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestHeader type edge cases #80

Open
megamaddu opened this issue Sep 1, 2016 · 1 comment
Open

RequestHeader type edge cases #80

megamaddu opened this issue Sep 1, 2016 · 1 comment

Comments

@megamaddu
Copy link

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" ] }
@garyb
Copy link
Member

garyb commented Sep 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants