Liran Siman Tov Liran Siman Tov - 1 year ago 139
reST (reStructuredText) Question

Rest assured throws ClientProtocolException when the status code is 303

In my workplace we are using rest assured 2.9 to send rest API requests, I'm getting a valid output containing both response body and status code even if the status code is 500,402.

BUT the only case this isn't working is error 303 See Other, I'm getting Method threw org.apache.http.client.ClientProtocolException exception and I can't parse the information that way, all the other status codes are returning status code and body, only 303 throws exception.
The API isn't the problem, because sending the API through post man work as expected, the call is


Answer Source

Use: redirects().follow(false)

For example: given().redirects().follow(false).body(body.toString()).post(url);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download