-
Notifications
You must be signed in to change notification settings - Fork 44
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
If the Header content is a String, quotes are added #11
Comments
Do I understand correctly: servant has an implementation for FromHttpApiData String/Text and it does not encode with quotes there? That sucks. I don't use plain strings as headers but my own data types - there it is easy to implement parseHeader with jsonParseHeader which is compatible with servant-purescript's encoding. You can use this workaround in the meantime (if appropriate), while I am trying to find a good fix for this problem. |
Should be fixed with version 3.0.1 of purescript-servant-support - please try and re-open if it does not work. |
Thank you for your bug report and have a pleasant stay. |
Thanks! I had a look, I fear a similar issue might happen with other prim types such as Int, for instance. Anyway, I will try it as soon as I come back home. |
Numbers and bool should be fine. Here http-api-data is compatible with our JSON encoding. There is a default encoding for time, maybe and either which are incompatible - ok - I am going to need some more special cases. |
I added a corresponding issue: eskimor/purescript-servant-support#2 |
Great! Thanks a lot for that, I will try to help if I find something else (: |
Okay so now I have another issue. If my String contains a special character, such as I am still searching in the purescript-servant-support the reason of this. |
Regarding the
Header
combinator, if its content is a String, Servant reads the raw string as far as I know. Hovewer, servant generated code call the settingsencodeURLPieces
(seeservant-purescript/src/Servant/PureScript/CodeGen.hs
Line 169 in 09548d5
The example uses
gShow
(or I think I sawgDefaultEncodeURLPieces
or something), butgShow
adds quotes to a string. My string is a token, so you guess it is not a good idea to mess with token content…Do you have any idea on how we can fix that? One idée could be to add the
ToHttpApiData
type class to mimic Servant? Then change theGeneric a => a -> String
to the new typeclass? It might be less flexible, though.Thanks by advance!
The text was updated successfully, but these errors were encountered: