I use akka http client 2.4.6 to post a json to server (server requires message's content type to be applicaton/json to handle):
val request = HttpRequest(uri = "http://localhost:9000/auth/add-user",
method = HttpMethods.POST,
entity = ByteString(write(createUser)))
.withHeaders(headers.`Content-Type`(ContentTypes.`application/json`))
Http().singleRequest(request)
And I receive this warning:
Explicitly set HTTP header 'Content-Type: application/json' is ignored, explicit
Content-Type
header is not allowed. SetHttpRequest.entity.contentType
instead.
and error on server side is:
415 Unsupported Media Type
How do I properly set content type for it?