泽西客户端没有在301响应上正确重定向(在PATCH之后)

时间:2015-08-26 21:58:27

标签: http jersey jax-rs jersey-client

我使用Jersey客户端使用PATCH方法向API发出更改资源ID的请求:

Client client = ClientBuilder.newClient()
    .property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true); // To allow PATCH
...
// Setting uri, path, accessToken and entity used below
...
WebTarget target = client.target(uri).path(path);
Response response = target.request(MediaType.APPLICATION_JSON)
    .header(HttpHeaders.AUTHORIZATION, BEARER + accessToken)
    .method("PATCH", entity);

我在Fiddler中看到ID已成功更改:a" 301永久移动"返回带有Location标头的响应,Location标头包含具有新ID的URL 然后再次在Fiddler中我看到Jersey客户端在第一个请求之后立即从Location头调用URL,但是再次使用PATCH方法...
因为响应代码是301,所以它不应该使用GET向Location头中的URL发出请求吗?

感谢。

0 个答案:

没有答案
相关问题