【问题标题】:Rest assured throws ClientProtocolException when the status code is 303状态码为303时放心抛出ClientProtocolException
【发布时间】:2016-11-23 10:36:33
【问题描述】:

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

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

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

【问题讨论】:

    标签: java rest rest-assured http-status-code-303


    【解决方案1】:

    使用:redirects().follow(false)

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

    【讨论】:

      猜你喜欢
      • 2019-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多