URL encoding (Percent-encoding)

Sometimes,  I get the API URL using Developer tool in browser like Chrome for assertion in automation test script, And I usually get something like this:

http://example.com/query?q=random%20word%20%A3500%20bank%20%24

When you see this kind of encoded path including %20,%A3, %24 …, you will need to decode the path and use that path for sending the correct API requests.

Percent-encoding, also known as URL encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN). As such, it is also used in the preparation of data of the application/x-www-form-urlencodedmedia type, as is often used in the submission of HTML form data in HTTP requests.

full  URL Encoded Characters can be found here:

https://www.w3schools.com/tags/ref_urlencode.asp

Capture1

Capture2.JPG

 

 

Leave a comment