Skip to content

Instantly share code, notes, and snippets.

@petekneller
Created April 9, 2014 08:10
Show Gist options
  • Save petekneller/10239661 to your computer and use it in GitHub Desktop.
Save petekneller/10239661 to your computer and use it in GitHub Desktop.
Multipart upload using dispatch-mime lib
import dispatch.classic./\
import dispatch.classic.mime.Mime.MimeRequestTerms
val multipart = new MimeRequestTerms(/\) <<*("counterparty-file", anyString(), bytes)
val byteStream = new ByteArrayOutputStream()
multipart.body.get.writeTo(byteStream)
Request(url, RequestMethods.POST,
Map(HttpHeaders.ContentType.value -> multipart.body.get.getContentType.getValue),
byteStream.toByteArray)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment