Rest Groovy转义问号

Rest Groovy转义问号,rest,groovy,spock,Rest,Groovy,Spock,我正在使用groovy编写spock测试。 我想获取包含?的url路径。 但它总是变成: 发送请求: GET /test%3Fsearch=blub HTTP/1.1 我试图用\或\或/ restClient.get(path: '/test?search='+search, requestContentType: 'application/json') 我认为您应该以更惯用的方式使用RESTClient,如: restClient.get(path: '/test', query:[ se

我正在使用groovy编写spock测试。 我想获取包含
的url路径。 但它总是变成:

发送请求:

GET /test%3Fsearch=blub HTTP/1.1
我试图用
\
\
/

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

我认为您应该以更惯用的方式使用RESTClient,如:

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

问题不在于Groovy字符串转义(它不只是自动对URL进行编码),而在于作为rest客户机使用的任何东西。从哪里获得
restClient
?@Peter import groovyx.net.http.restClient惯用的方法奏效了