Thanks for the tip. I guess I still do not know HTTP that well :-)
I looked at the multi-part, it looks like I can render EntityBody as parts
in the message, but I also need to render the HTTP request line as well:
odata batch format:
--boundary_xx
Content-Type: application/http
Content-Transfer-Encoding: binary
RequestLine... e.g. PUT ...
RequestBody... e.g. { "jsonstuff": ... }
Playing with your modified snippet shows that the body parts get into the
message.
How would I get the Request Line above the actual entity body for each part?
It's almost like having an EntityBody being a HttpRequest itself.
This almost works:
val xm = Multipart.General(MediaTypes.`multipart/mixed`,
Multipart.General.BodyPart.Strict(HttpEntity.Strict(ContentTypes.`application/json`,
ByteString("json1"))),
Multipart.General.BodyPart.Strict(HttpEntity.Strict(ContentTypes.`application/json`,
ByteString("json2"))),
Multipart.General.BodyPart.Strict(HttpEntity.Strict(ContentTypes.`application/json`,
ByteString("json3")))
)
Await.result(xm.toEntity(HttpCharsets.`UTF-8`,
"batch_456").dataBytes.map(_.utf8String).runWith(Sink.head), 1 seconds)
--batch_456
Content-Type: application/json
json1
--batch_456
Content-Type: application/json
json2
--batch_456
Content-Type: application/json
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.