PUT请求以表单数据上传文件使用空手道
PUT requests to upload a file in form data Using karate
我已经尝试为以下 curl 请求编写等效的空手道脚本
curl -X PUT \
'http://localhost:8055/uploadfile' \
-H 'content-type: multipart/form-data;' \
-F code=@/Users/test/Downloads/Next.zip
试过空手道剧本
Given path 'uploadfile'
#Given header Content-Type = 'multipart/form-data'
And form field code = '/Users/test/Downloads/Next.zip'
#And multipart file code = { read: '/Users/test/Downloads/Next.zip' , contentType: 'application/zip' }
When method PUT
Then status 200
我是不是做错了什么(尝试了不同的东西)?仍然没有得到预期的 API 响应。
仅供参考:我从邮递员那里得到了那个 curl 命令,它工作正常。
你提供的信息有限,很难判断。试试这个:
Given url 'http://localhost:8055/uploadfile'
And multipart file code = { read: 'file:/Users/test/Downloads/Next.zip', filename: 'Next.zip', contentType: 'application/zip' }
When method put
如果您仍然卡住,请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue(或使用 postman ;)
我已经尝试为以下 curl 请求编写等效的空手道脚本
curl -X PUT \
'http://localhost:8055/uploadfile' \
-H 'content-type: multipart/form-data;' \
-F code=@/Users/test/Downloads/Next.zip
试过空手道剧本
Given path 'uploadfile'
#Given header Content-Type = 'multipart/form-data'
And form field code = '/Users/test/Downloads/Next.zip'
#And multipart file code = { read: '/Users/test/Downloads/Next.zip' , contentType: 'application/zip' }
When method PUT
Then status 200
我是不是做错了什么(尝试了不同的东西)?仍然没有得到预期的 API 响应。
仅供参考:我从邮递员那里得到了那个 curl 命令,它工作正常。
你提供的信息有限,很难判断。试试这个:
Given url 'http://localhost:8055/uploadfile'
And multipart file code = { read: 'file:/Users/test/Downloads/Next.zip', filename: 'Next.zip', contentType: 'application/zip' }
When method put
如果您仍然卡住,请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue(或使用 postman ;)