状态码为303时放心抛出ClientProtocolException

Rest assured throws ClientProtocolException when the status code is 303

在我的工作场所,我们使用 rest assured 2.9 发送 rest API 请求,我得到了包含响应正文和状态代码的有效输出,即使状态代码是 500,402。

但唯一不起作用的情况是错误 303 请参阅其他,我收到 Method throw org.apache.http.client.ClientProtocolException 异常,我无法解析信息这样,所有其他状态代码都返回状态代码和正文,只有 303 抛出异常。 API 不是问题,因为通过 post 人发送 API 按预期工作,调用是

given()
 .body(body.toString())
 .post(url);

使用:redirects().follow(false)

例如: given().redirects().follow(false).body(body.toString()).post(url);