Forum Discussion

shales's avatar
shales
Occasional Contributor
5 years ago
Solved

Colon (:) is being sent as ascii (%3A) in HTTP Request

I have a timestamp parameter.  I need to pass this parameter into a request as a query parameter.  When the request runs the colons ( : ) in the time field are converted to ascii (%3A) causing the request to fail.  I updated my ReadyAPI settings to use UTF-8 encoding.  I am unable to get the request to send the timestamp without converting the colons.  Is there a way to prevent the characters from being changed to ascii?

 

Example: 
The timestamp is: 09-23-19T11:41:27

The request passes the timestamp as: 09-23-19T11%3A41%3A27

  • Hey shales,

    This behaviour is srandard and i wouldn't expect anything else...any http request which contains a colon char in a parm value is % encoded like this....Are you sure the error you are seeing is from % encoding your colon : character?

    The reason i ask is that the RFCs that discuss % encoding indicate that a colon is reserved character and has special meaning in URLs. Its the same as say the ? (indicates the end of the Template parameters and beginning of the Query and Matrix portion of the URI string) and / character (separators in your URI string before the query string).

    The colon character is used to separate the protocol (e.g. http, ftp, etc.) from the server portion of your request.

    With the above in mind, id suggest you double check the error youre getting, cos it doesnt make sense that your endpoint isnt expecting the colon to be % encoded. I'm a
    positive the reason your request is failing is due to a different reason!

    If you can publish your readyapi, http and error logs we can probably nail down what the issue is straight away.

    Have you confirmed the timestamp you are passing should include the 'T' character (the date/time separator). I know its often included in datetimestamp values but ive worked on systems where the request fails cos the endpoint isnt expecting the T in the request or GET requests fail when searching using a datetime as a query parameter (to retrieve records from database) cos the none of the records timestamps in the database are stored with the T character.

    There is a checkbox that enables you to disable % encoding, but im pretty sure this wont help. In the Projects section, highlight the request's query parameter and select to view the advanced options. At the bottom is a checbox entitled 'Disable URL encoding'. This stops the %encoding for the specific query parameter selected.

    Cheers,

    Rich

1 Reply

  • richie's avatar
    richie
    Community Hero
    Hey shales,

    This behaviour is srandard and i wouldn't expect anything else...any http request which contains a colon char in a parm value is % encoded like this....Are you sure the error you are seeing is from % encoding your colon : character?

    The reason i ask is that the RFCs that discuss % encoding indicate that a colon is reserved character and has special meaning in URLs. Its the same as say the ? (indicates the end of the Template parameters and beginning of the Query and Matrix portion of the URI string) and / character (separators in your URI string before the query string).

    The colon character is used to separate the protocol (e.g. http, ftp, etc.) from the server portion of your request.

    With the above in mind, id suggest you double check the error youre getting, cos it doesnt make sense that your endpoint isnt expecting the colon to be % encoded. I'm a
    positive the reason your request is failing is due to a different reason!

    If you can publish your readyapi, http and error logs we can probably nail down what the issue is straight away.

    Have you confirmed the timestamp you are passing should include the 'T' character (the date/time separator). I know its often included in datetimestamp values but ive worked on systems where the request fails cos the endpoint isnt expecting the T in the request or GET requests fail when searching using a datetime as a query parameter (to retrieve records from database) cos the none of the records timestamps in the database are stored with the T character.

    There is a checkbox that enables you to disable % encoding, but im pretty sure this wont help. In the Projects section, highlight the request's query parameter and select to view the advanced options. At the bottom is a checbox entitled 'Disable URL encoding'. This stops the %encoding for the specific query parameter selected.

    Cheers,

    Rich