Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to handle Special character in query param value in Rest assured

I'm struggling with handling special character in query parameter value while working with Rest Assured.

In url (as given below), I have to pass the value which is separated with pipe symbol '|'. I encoded symbol with value %7C however service call doesn't not give matching response instead returns default response.

http://localhost:8080/api/abc?Id=7325860%7CXYZ

Interesting part is same url works fine with any browser rest client or other java based solution.

like image 639
Parveen Y Avatar asked Aug 02 '16 10:08

Parveen Y


1 Answers

REST Assured performs URL encoding for query parameters by default. You can easily disable it though:

given().urlEncodingEnabled(false).when().get("http://localhost:8080/api/abc?Id=7325860%7CXYZ");

See documentation for more info.

like image 104
Johan Avatar answered Nov 08 '22 11:11

Johan