【问题标题】:Unable to upload zip file through karate framework无法通过空手道框架上传 zip 文件
【发布时间】:2020-03-27 16:59:39
【问题描述】:

我正在尝试使用堆栈溢出参考通过空手道框架上传 zip 文件:put-requests-to-upload-a-file-in-form-data-using-karate 和空手道文档upload.feature

请在下面找到代码:

Given path 'upload'
And header Content-Type = 'application/zip'
And multipart file code = { read: 'file:tests/create/export.zip', filename:'export.zip', contentType: 'application/zip' }
When method POST
Then status 200

我们收到的错误是httpStatusCode="500"><links/><message>No ZIP data entries were found to import.</message>

【问题讨论】:

    标签: rest karate


    【解决方案1】:

    当您使用multipart file 时,您不设置Content-Type,它将默认为multipart/form-data。这很可能是您想要的 - 但如果没有有关您的服务器的详细信息,没有人能够说出。

    如果需要解决此问题,请与您的服务器端团队中的某个人合作。或者使用 有效 的 cURL 命令编辑您的问题,也许我们可以找出您做错了什么。

    在 Stack Overflow 上也可以搜索其他答案:https://stackoverflow.com/search?q=%5Bkarate%5D+multipart

    否则请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

    【讨论】:

      猜你喜欢
      • 2018-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多