Reputation: 115
I have a Map<String, Object>
of parameters. Some of these parameters have lists and rest assured will set the parameter value as a comma separated list:
http://url.com/rest?field1=value&fieldlist=1,2,3
I am using jersey and for some reason it doesn't accept these CSV lists. It accepts parameter lists with repeating values:
http://url.com/rest?field1=value&fieldlist=1&fieldlist=2&fieldlist=3
Is there a way I can configure rest-assured to write lists in this way?
This is marked as a duplicate and it can no longer be answered, but I found the answer to the question.
Answer:
I was using rest-assured version 1.8.2 but I needed to update to 1.9.0. This issue is directly reported here: https://code.google.com/p/rest-assured/issues/detail?id=169&can=1&q=query%20parameters
Upvotes: 6
Views: 5633
Reputation: 40618
In REST Assured you just do like this:
given().queryParam("fieldlist", "1", "2", "3"). ..
You don't need to construct the URL manually. Version 1.9.0
is also really old. You should update to the latest version.
Upvotes: 3
Reputation: 115
I had to set the values for the fields in the path manually. I was also on version 1.8.2 which still did not support repeating query parameters because of an issue with rest-assured. Updating to 1.9.0 allowed me to repeat the query parameters manually in the path.
Upvotes: 1