The recommendation from https://github.com/akka/akka/issues/19062 is to use
a http Bidi to handle the rendering in a nice non-api exposing way. The
idea is to get a ByteString that is the result of the http layer rendering
a HttpRequest.
You can do something like this to get a bidi flow:
val cl = Http().clientLayer(Host("blah.com"))
val noSslTls = SslTlsPlacebo.forScala
val test1 = cl atop noSslTls join Flow[ByteString].map{x =>
println(x.utf8String); x}
val response = Source.single(HttpRequest()).via(test1).runWith(Sink.head)
The out from running this is:
GET / HTTP/1.1
Host: blah.com
User-Agent: akka-http/2.3.12
response: Future[HttpResponse] =
scala.concurrent.impl.Promise$DefaultPromise@6159c8be
But you really get back an exception for each HttpRequest you put into
this. The ByteString of the rendered body is on out1.
Await.result(response, 1 second)
akka.stream.scaladsl.One2OneBidiFlow$OutputTruncationException$
So I need to turn-off 1/2 of the bidi or map or route around the out2 so
that I get a ByteString as an output from this bidi.
Is there anyway to do this? As soon as I do a join the out1 and in2 get
connected and there is no way to turn that off. I need to make sure that
1/2 of the bidi never runs because I only care about the HttpRequest to
ByteString rendering.
--
>>>>>>>>>> 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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.