You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because we at servant-purescript are lazy people we just use a url-encoded JSON default encoding for headers, path pieces and queries. This works well for simple types or if you don't care about the looks.
Unfortunately http-api-data has a few default encodings which are incompatible.
So if you are using:
Time
Maybe
Either
directly (not contained in a user defined type) for headers, urlpieces,.. - you are doomed.
Just kidding - a workaround is easy: Use a newtype wrapper and implement the http-api-data yourself using the helpers defined in Servant.Purescript.
This is related to servant-purescript#6, but even if user's can't yet customize the used encoding they should at least get a default encoding that works in all cases.
A special case for String/Text is already implemented, we need similar rules for the other types.
As usual, as I am super busy - any help would be appreciated. If you stumble upon making use of those types - please consider adding a special rule for your type and make sure it works for your application.
The text was updated successfully, but these errors were encountered:
Okay so probably this is a better spot to talk about it.
I still have an issue with Strings. It works well for alphanumeric chars, but for special ones… not so much. Indeed, if my String contains a special character, such as / or +, they are translated into %20 or whatever (I do not remember the exact numbers).
I am still searching in the purescript-servant-support the reason of this.
Edit: Oh. It is because you are calling encodeToURLPieces.
Because we at servant-purescript are lazy people we just use a url-encoded JSON default encoding for headers, path pieces and queries. This works well for simple types or if you don't care about the looks.
Unfortunately http-api-data has a few default encodings which are incompatible.
So if you are using:
directly (not contained in a user defined type) for headers, urlpieces,.. - you are doomed.
Just kidding - a workaround is easy: Use a newtype wrapper and implement the http-api-data yourself using the helpers defined in
Servant.Purescript
.This is related to servant-purescript#6, but even if user's can't yet customize the used encoding they should at least get a default encoding that works in all cases.
A special case for String/Text is already implemented, we need similar rules for the other types.
As usual, as I am super busy - any help would be appreciated. If you stumble upon making use of those types - please consider adding a special rule for your type and make sure it works for your application.
The text was updated successfully, but these errors were encountered: