【问题标题】:How to send -d information in rest assured?如何放心发送-d信息?
【发布时间】:2020-09-21 12:03:24
【问题描述】:

我正在尝试自动化一个需要发送 -d 信息的 api。

curl 请求看起来像这样-

curl -X PUT "https://XXXXXXX.com/v1/YOLO/cccc/abc/mom" -H "accept: */*" -H "Content-Type: application/json" -d "[10035]"

我无法在请求中发送-d "[10035]"这部分。

需要放心,这就是我正在尝试的-

RequestSpecification request = given().filter(new RequestLoggingFilter(requestCapture));
        Response response =  request.auth().basic(XXX,XXX).body(Arrays.asList("10017")).contentType("application/json")
                .put(Chttps://XXXXXXX.com/v1/YOLO/cccc/abc/mom").then().extract()
                .response();

感谢您的帮助。

【问题讨论】:

  • 根据 CURL 文档,-d 用于在正文中发送帖子数据,只需使用 body("[10035]")
  • 这个我试过了,但是没用。

标签: java rest curl rest-assured


【解决方案1】:

尝试使用

 curl --data-raw "[10035]" https://example.com

【讨论】:

    猜你喜欢
    • 2011-01-11
    • 2021-12-26
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-18
    • 2012-08-31
    • 2015-11-27
    相关资源
    最近更新 更多