Search code examples
restgroovyspock

Groovy escaping question mark


I am using groovy to write spock tests. I would like to get the url path with the ? in it. But it always turns into:

Sending request:

GET /test%3Fsearch=blub HTTP/1.1

I've tried to escape with \\ or \ or /

restClient.get(path: '/test?search='+search, requestContentType: 'application/json')

Solution

  • I think you should be using the RESTClient the more idiomatic way like:

    restClient.get(path: '/test', query:[ search:'search' ], ... )