asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
205 stars 84 forks source link

query parameter encoding : to %3A in request #66

Closed goehlemichael closed 2 years ago

goehlemichael commented 5 years ago

I am making a Get request and passing a date-time inside of a query parameter.

for example:

REST.Get
...  https://url.example
...  query={"fromDate": "2019-03-26T00:00:00", "toDate": "2019-03-27T00:00:00"}
Output

The output is showing me that the request is being made as

...
"query": {
    "fromDate": "2019-03-26T00:00:00",
    "toDate": "2019-03-27T00:00:00"
...

However,

I get a 400 from the server I am trying to make the request to due to the fact that it is received as:

{"fromDate": "2019-03-26T00%3A00%3A00", "toDate": "2019-03-27T00%3A00%3A00"}

asimell commented 3 years ago

I believe this is because the query is added to your request URL, so it will be urlencoded. In other words it parses your query to https://url.example?fromDate=2019-03-26T00%3A00%3A00&toDate=2019-03-27T00%3A00%3A00.

This library uses requests in the background. I don't know whether it has an option to disable urlencoding. If not, then there's not really an option for this library to do that either.

Atihinen commented 2 years ago

After investigating it's proven that requests library is doing the encoding and it currently doesn't provide ways to disable the url encoding by any conventional means. Closing the issue for now