-
Notifications
You must be signed in to change notification settings - Fork 213
Description
Hi,
First of all, thank you for this crate !
Looking at the implementation of query(), I see that the function percent encode the key and the value, this is a behavior that is not documented as far as I can tell.
For me, what I understood was that it would only add after the URI the ? followed by the key as is, the = and the value as is (and add the & when there are more than one query param)
I did not expect the percent encoding.
Also, looking further, I see your AsciiSet definition for the encoding.
Looking at the URL specs from https://url.spec.whatwg.org/, I think you are missing a one character, ' , and that you might want to add .add(b'\'') to your set.
(It is talked about here and here)
Also testing on this tool https://url-decode.com/tool/url-encode, it seems that ' should be encoded too but I have no idea about the merit of this tool.
Anyway, I think it would be a good idea to document that query() percent encode the key and the value and that there is no need for the users to encode themselves.
Also, it would be nice to have an escape hatch (other than not using query() and manually put the query in the "base uri" in get()), and to have a query_raw() that simply does not encode a let the user encode themself in the case they want to use another, customized, AsciiSet.
But it might conflict the minimalistic vision of this crate...
I can make a PR for the documentation and also the query_raw() if you want, please let me know
Regards