1

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

xoido
  • 7
  • 1

1 Answers1

0

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

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thanks for the answer. I suspected this might be the case so I got the file from the server and tried to decode it (using www.base64decode.org) but I got the response that it is not a valid base64 decoded file. Is there an option to disable this decoding for binary files? – xoido Sep 20 '18 at 14:19
  • @xoido no, it should not be needed as per the HTTP spec – Peter Thomas Sep 20 '18 at 14:21