【问题标题】:How to frame the rest assured script for a post request based on CURL如何为基于 CURL 的 post 请求构建放心脚本
【发布时间】:2018-08-16 15:44:58
【问题描述】:

我需要将下面的 curl 命令转换为放心的 POST 请求。 谁能帮帮我

curl -ks --http1.0 -X POST "$server?format=pdf&tid=TD1" --cookie "INTERSET_SESSION=$access_token" -H 'content-type: multipart/form-data' -F 'template=@../templates/dashboard.hbs' -o output.pdf

参数template=@../templates/dashboard.hbs保存一个文件。

【问题讨论】:

    标签: rest-assured


    【解决方案1】:

    检查以下是否有帮助

    {
        RequestSpecification req = RestAssured.given();
        req.header("Content-Type", "multipart/form-data");
        req.header("Cookie", "INTERSET_SESSION=ABCD");
        req.multiPart("file2", new File("template=@../templates/dashboard.hbs"));
        Response resp = req.post("$server?format=pdf&tid=TD1");
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-13
      • 1970-01-01
      • 2020-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多