It is actually not wrong,
Url encoding is required to differentiate between special characters in your data vs special characters that are reserved to construct the URL.
Reserved Characters URL Encoding:
: Separate protocol (http) from address encoded as %3B
/ Separate domain and directories encoded as %2F
# Separate anchors encoded as %23
? Separate query string encoded as %3F
& Separate query elements encoded as %24
@ Separate username and password from domain encoded as %40
% Indicates an encoded character encoded as %25
+ Indicates a space encoded as %2B
<space> Not recommended in URLs encoded as %20 or +
so if you are going to pass any special characters as data via URL you need to % encode
them to avoid conflicts.
In karate, if you want to avoid your URL getting encoded, don't construct your URL using path, params, param definitions.
Instead, build your entire URL as a string and pass it to url
. like,
* url 'http://httpbin.org/get?Name=Stark'
You might get an exception if you are trying to pass any special
characters in this.
so consider encoding the URL if you are going to pass any special characters.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…