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

QueryParam doesn't conform to HTTP #1626

Open
cblp opened this issue Nov 1, 2022 · 5 comments
Open

QueryParam doesn't conform to HTTP #1626

cblp opened this issue Nov 1, 2022 · 5 comments

Comments

@cblp
Copy link

cblp commented Nov 1, 2022

Instance HasClient QueryParam' uses this function

encodeQueryParam :: ToHttpApiData a => a  -> BS.ByteString
encodeQueryParam = BL.toStrict . toLazyByteString . toEncodedUrlPiece

where toEncodedUrlPiece is from http-api-data package, where it is documented to be applicable to path segments only, not to query parameters. As a result, if we try to send a simple text string as a parameter,

type API = QueryParam "p" Text

this will be encoded as ?p=a%20+%20b which is wrong, because + is the encoding for the space, and + must be encoded as %2B.

?p=a%20+%20b is interpreted by a standard-conforming server as p = "a b".

p = "a + b" must be encoded as ?p=a+%2B+b

@cblp
Copy link
Author

cblp commented Nov 1, 2022

@ysangkok
Copy link
Contributor

@cblp Has this been addressed by #1597, which was released as part of servant-0.20?

@cblp
Copy link
Author

cblp commented Jun 25, 2023

I think, this is already fixed in http-api-data, but I can't recheck right now.

@tchoutri
Copy link
Contributor

@cblp Is this still an ongoing problem?

@cblp
Copy link
Author

cblp commented Apr 27, 2024

Look like it's fixed, but I'm not sure.

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

3 participants