【问题标题】:How to save downloaded ZIP file from the Endpoint with KARATE [duplicate]如何使用 KARATE 从端点保存下载的 ZIP 文件 [重复]
【发布时间】:2020-11-13 11:39:16
【问题描述】:

我是空手道的新手,所以我需要你的帮助。 我有 .feature 文件。我们有 API 应该返回带有提交数据的 .zip 文件

    Given path EndpointUrl + 'request-commit/{param1}/{param2}'
    When method GET
    Then status 200
    And def responsebytes = responsebytes

总体脚本工作正常,因为在内容处置中我确实看到了附件“.zip”文件

如果我使用

curl -k link --request GET -H 'content-type: application/json' -H 'client_id: 12344' -H 'accept: application/json' -O -J 

我可以从 remote_host 下载 .zip 文件

但是如何在脚本执行后将 zip 压缩到本地目录? 如何在空手道中使用 curl 调用中的正确标志 -O 和 -J? 你能帮我解决这个问题吗?

谢谢!

【问题讨论】:

    标签: maven curl karate


    【解决方案1】:

    这应该将文件保存到target/foo.ziphttps://stackoverflow.com/a/54593057/143475

    * karate.write(responseBytes, 'foo.zip')
    

    您也可能会觉得这很有趣:https://stackoverflow.com/a/64352676/143475

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 2018-09-24
      • 2013-04-29
      • 2021-11-19
      • 2017-01-10
      • 2018-09-05
      相关资源
      最近更新 更多