Custom URL Encoding
Function Name
$urlEncoder(String A)
Parameter Description
String A: parameter to be encoded. It can contain up to 2,000 characters. UTF-8 is used for encoding.
Function Description
This function is used for custom URL encoding of API automation test case parameters.
Application Scenarios
This function can be used in the following parts of an API automation test case. (Do not use the function for environment parameters. Otherwise, input will be output.)
- Request URL
- Request header
- Request Body
- Checkpoint property
- Response extraction
- if condition
- for loop interrupt condition
Example
- Request URL
As shown in the following figure, the value of test in the request URL is the custom URL encoding function. Parameter A in the function is the string abc123Test.

- Request header
As shown in the following figure, the value of Accept-Encoding in the request URL is the custom URL encoding function. Parameter A in the function is the string abc123Test.

- Request body
As shown in the following figure, the request body uses the custom URL encoding function. Parameter A in the function is the function for generating random strings of a specified length $random_string(10).

- Checkpoint property
As shown in the following figure, the target value of the checkpoint property result is the custom URL encoding function. Parameter A in the function is the local parameter test. For details about how to set local parameters, see Local Parameters.

- if condition
As shown in the following figure, the target value of the if condition is the custom URL encoding function. Parameter A in the function is the environment variable status. For details about how to set environment parameters, see Setting Environment Parameters of an API Script.

- for loop interrupt condition
As shown in the following figure, the target value of the for loop interrupt condition is the custom URL encoding function. Parameter A in the function is the string abc123Test.

What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot