Skip to content

responseHeaders's runtime representation isn't necessarily a StrMap String #4

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

Closed
Thimoteus opened this issue Apr 20, 2016 · 3 comments

Comments

@Thimoteus
Copy link

When running tests for one of my libraries, I tried to print the responseHeaders from a Response and got the following:

Response headers:

TypeError: s.replace is not a function
    at exports.showStringImpl (/home/thimotron/Programming/purescript-simple-request/output/Prelude/foreign.js:23
1:19)

I tracked it down to the fact that the responseHeaders in question had a "set-cookie" key with an Array String value.

@hdgarrood
Copy link
Member

argh node: https://nodejs.org/api/http.html#http_message_headers

Seems like it's just "set-cookie" that we have to worry about.

@Thimoteus
Copy link
Author

How terrible would it be to give it a StrMap Foreign type?

@hdgarrood
Copy link
Member

That would be better than what we have now. Since we know it's either String or Array String, though, I think I'd rather define a foreign type HeaderValue or something, and then provide a function HeaderValue -> Either String (Array String). Also open to other suggestions.

@paf31 paf31 closed this as completed in #8 Aug 14, 2016
paf31 pushed a commit that referenced this issue Aug 14, 2016
`responseHeaders` and `responseCookies` because headers have type
  String while cookies are Array String
  Fixes #4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants