8

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.

Parveen Y
  • 101
  • 1
  • 1
  • 5

1 Answers1

27

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.

Johan
  • 37,479
  • 32
  • 149
  • 237