I am trying to write a test case for a jersey resource using InMemory container privided by Jersey.
As my service method contains many multivalued parameters as filters, i opted to send all of those values as single JSON parameter, so that it will be easy to send list of values for each filter.
When i send the JSON string in target("path").queryParam("filters", jsonString).request().get();
This call is failed because Jersey client has an internal query builder which is parsing url and checking for path param templates in url. Now url contaims my JSON with "{" in it, which is interpreted as path param. If I try to encode the JSON using URLEncode.encode(jsonStr, "UTF-8"). With this the path param template issue solved but white spaces in JSON are received by server as "+" as jersey client encoding URL one more time, but server decoding it only once.
If I make the Queryparam as post param test is working, but i don't want to use POST for just to retrieve data.
I can't post original code due to company policies.
My question is, is there any way to disable path template check in jersey clieny by setting custom builder.
Aucun commentaire:
Enregistrer un commentaire