Adds the ability to add a byte array to a multipart post #74

merged 1 commit into from Apr 23, 2012

2 participants


Adds a couple of new <<* methods that take in a byte array as the source for the multipart file data. This complements the existing file and stream generator versions.

Setting the data from a byte array is a common use case when uploading images that have been manipulated or generated in scala code.

The ByteArrayBody used sets the Content-Length headers (similarly to the FileBody), this prevents problem when chunking large data submissions. I had problems with a squid proxy that was rejecting chunked requests when I set the data using the InputStream mechanism, using the ByteArrayBody and hence the content length data prevented this.

@steppenwells steppenwells Adds ability to create a multipart post from a byte array.
The underlying ByteArrayBody correctly sets the content length which is
not set when using the inputStream generator approach.
@n8han n8han merged commit 99beaa0 into dispatch:master Apr 23, 2012

thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment