Skip to content
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.

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

Merged
merged 1 commit into from Apr 23, 2012

Conversation

steppenwells
Copy link
Contributor

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.

The underlying ByteArrayBody correctly sets the content length which is
not set when using the inputStream generator approach.
n8han pushed a commit that referenced this pull request Apr 23, 2012
Adds the ability to add a byte array to a multipart post
@n8han n8han merged commit 99beaa0 into dispatch:master Apr 23, 2012
@n8han
Copy link

n8han commented Apr 23, 2012

thanks for the contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants