Skip to content

Instantly share code, notes, and snippets.

@dwestheide
Created November 9, 2011 21:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwestheide/1353058 to your computer and use it in GitHub Desktop.
Save dwestheide/1353058 to your computer and use it in GitHub Desktop.
Byte array support for Dispatch
def <<< (bytes: Array[Byte], content_type: String): Request = {
val e = new org.apache.http.entity.ByteArrayEntity(bytes)
e.setContentType(content_type)
PUT.copy(body = Some(e))
}
def << (bytes: Array[Byte], content_type: String): Request = {
val e = new org.apache.http.entity.ByteArrayEntity(bytes)
e.setContentType(content_type)
POST.copy(body = Some(e))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment