Agreed that it would be nice to reuse 
HttpRequestRendererFactory.renderToSource in this case.

Could you open a ticket?

Cheers
André

On Tuesday, December 1, 2015 at 7:01:03 AM UTC+1, Devon Miller wrote:
>
> I looked more into this issue and found that to get the request to fully 
> render so I can append them into a multipart body, I needed to use internal 
> API, or at least, this is the only way I could figure it out quickly. You 
> just need to run the HttpRequests into the Flow defined below. The code 
> comes from OutgoingConnectionBlueprint.
>
> package akka.http.impl.engine.client
>
> import akka.http.impl.engine.rendering.HttpRequestRendererFactory
> import akka.http.impl.engine.rendering.RequestRenderingContext
> import akka.stream.scaladsl.Flow
> import akka.http.scaladsl.model.HttpRequest
> import akka.util.ByteString
> import mscrm._
> import akka.event._
> import akka.http.scaladsl.model.headers._
> import concurrent.ExecutionContext
> import akka.stream._
> import akka.actor._
>
>
> object RequestRenderer {
>
>   def renderRequestFlow(hostname: String)(implicit ec: ExecutionContext, 
> mat: Materializer, as: ActorSystem) = {
>     
>     val log = Logging.getLogger(implicitly[ActorSystem], this)
>     val hostHeader = Host(hostname)
>     val requestRendererFactory = new HttpRequestRendererFactory(None, 128, 
> log)
>
>     val requestRendering: Flow[HttpRequest, ByteString, Unit] = 
> Flow[HttpRequest]
>       .map(RequestRenderingContext(_, hostHeader))
>       
> .via(Flow[RequestRenderingContext].flatMapConcat(requestRendererFactory.renderToSource).named("renderer"))
>
>     requestRendering
>   }
> }
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to