Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

rest - Unable to upload zip file through karate framework

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

Please find the code below:

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

We are getting the error as httpStatusCode="500"><links/><message>No ZIP data entries were found to import.</message>

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

Also search for other answers on Stack Overflow: https://stackoverflow.com/search?q=%5Bkarate%5D+multipart

Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...