Closed Hugh-ifly closed 4 years ago
In
val bodyPart1 = Multipart.General.BodyPart.Strict(body1.toJson.compactPrint, headers)
the body1.toJson.compactPrint
part is implicitly converted into an HttpEntity
. You can instead provide an HttpEntity
explicitly where you would put in the content type. Something like this:
val bodyPart1 = Multipart.General.BodyPart.Strict(HttpEntity(ContentTypes.`application/json`, body1.toJson.compactPrint), headers)
My target is to implement an http2 server which is compatible with Amazon Alexa-Voice-Service protocols ( https://developer.amazon.com/docs/alexa-voice-service/structure-http2-request.html#responses).
The goal is to construct a Multipart-related HttpResponse. Here is an Example of HttpResponse as below:
However, I find no ways to set the
Content-Type
header of each Multipart.Bodypart. And I get this warning:Here is my code:
And the client always gets this reply:
It seems like the source code of Akka Http leaves no place to override this behavior. In
akka/http/scaladsl/marshalling/PredefinedToEntityMarshallers.scala
:Any suggestions or solutions will be appreciated! Thanks a lot!