Karate inflates binary file on a post

眉间皱痕 提交于 2020-01-15 10:34:29

问题


I am trying to post a large (16MB) binary file as multipart but the test keeps failing. When debugging using Wireshark (see screenshot) I found out that the payload size as well as the Content-Length are more than 30MB. Any idea what is happening? Here is the code:

Given path 'post/large/file'

And multipart file 16MB_file = { read: 'file:target/myBinaryFile', filename: 'myBinaryFileName', contentType: 'application/octet-stream' }
And header Authorization = 'Basic blablabla'
When method post
Then status 200

Wireshark screenshot


回答1:


Multipart will inflate a binary file because of the Base64 encoding that happens: What does enctype='multipart/form-data' mean?

So maybe the failure is some other problem. If you still think there's a bug I'll be happy to take a look if you follow this process (and omit the large file, I'll find one): https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

A pure binary POST looks like this (second scenario): https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/upload/upload-image.feature



来源:https://stackoverflow.com/questions/52424886/karate-inflates-binary-file-on-a-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!