Skip to content

Instantly share code, notes, and snippets.

@blzjns
Created August 10, 2016 18:19
Show Gist options
  • Save blzjns/4016d4bb5c66c70ad7ac38a77d82dc2d to your computer and use it in GitHub Desktop.
Save blzjns/4016d4bb5c66c70ad7ac38a77d82dc2d to your computer and use it in GitHub Desktop.
akka http custom content type
import akka.http.scaladsl.Http
import akka.http.scaladsl.client.RequestBuilding._
val customContentType = ContentType(MediaType.customWithFixedCharset("binary", "octet-stream", HttpCharsets.`UTF-8`)) //Content-Type: binary/octet-stream
val someData = "{}"
//simple http call using above content type
Http().singleRequest(
Put("http://127.0.0.1:8080/someendpoint")
.withEntity(customContentType, someData)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment