I\'m using the Groovy RESTClient class to do write some (spock) Acceptance tests for Java WebServices I\'ve been authoring.
One frustration I\'ve had is in testing the r
@JonPeterson came up with what I think is a better solution, so I gave his answer the checkmark:
client.handler.failure = client.handler.success
More info here
The solution I (previously) landed on:
restClient.handler.failure = { it }
Which is shorthand for
restClient.handler.failure = { resp -> return resp }
@JimmyLuong noted in the comments that this approach drops the data from the response, and suggested the following enhancement:
restClient.handler.failure = { resp, data -> resp.setData(data); return resp }