无法通过空手道框架上传 zip 文件 [英] Unable to upload zip file through karate framework
问题描述
我正在尝试使用堆栈溢出参考通过空手道框架上传 zip 文件:put-requests-to-upload-a-file-in-form-data-using-karate 和空手道文档 upload.feature
I am trying to upload a zip file through karate framework using the stack overflow reference: put-requests-to-upload-a-file-in-form-data-using-karate and karate documents 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">
推荐答案
当你使用 multipart file
你没有设置Content-Type
,它会默认为multipart/form-data
.这很可能是您想要的 - 但如果没有关于您的服务器的详细信息,没有人会知道.
When you use multipart file
you don't set the Content-Type
, and it will default to multipart/form-data
. Which is most likely what you want - but no one will be able to tell without details about your server.
如果需要解决此问题,请与您的服务器端团队的某个人合作.或者使用 有效 的 cURL 命令编辑您的问题,也许我们可以找出您做错了什么.
Work with someone from your server-side team if needed to resolve this. Or edit your question with a cURL command that works and maybe we can figure out what you are doing wrong.
也在 Stack Overflow 上搜索其他答案:https://stackoverflow.com/search?q=%5Bkarate%5D+multipart
Also search for other answers on Stack Overflow: https://stackoverflow.com/search?q=%5Bkarate%5D+multipart
否则请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
这篇关于无法通过空手道框架上传 zip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!