【问题标题】:PATCH method in Jetty ClientJetty 客户端中的 PATCH 方法
【发布时间】:2017-12-19 13:34:48
【问题描述】:

我正在尝试通过 Jetty 使用 HTTP PATCH 调用更新 json 片段。我发现PATCH不在HttpClient类的枚举中。

另一个 SO 问题 here 提出了同样的问题,但 method() 函数的链接现在是 404,我在 HttpClient 的 Jetty 源中找不到 method()。

是否有人有可用的示例或方法()函数的更新链接?

【问题讨论】:

    标签: jetty


    【解决方案1】:

    只需使用Request 对象中的method(String)

    Request request = client.newRequest("localhost", 8080)
                .method("PATCH")
                .path("/uri")
                .version(HttpVersion.HTTP_1_1);
    
     ContentResponse response = request.send();
     Assert.assertEquals(200, response.getStatus());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-19
      • 1970-01-01
      • 2016-04-20
      • 1970-01-01
      • 2014-04-16
      • 2010-11-03
      • 1970-01-01
      相关资源
      最近更新 更多