I am using akka-http and have been successfully supporting content negotiation by providing two marshallers for objects returned within Futures using Marshaller.oneOf
. But now I am experimenting with Source
streams for the first time. Is it possible to combine streaming support into one implicit like you can do with marshallers? I seem to only be able to support streaming JSON or CSV, but not both via content negotiation.
I think you can drop down to using the same underlying logic that the marshalling infra uses, take a look at akka.http.scaladsl.server.ContentNegotiator
and specifically pickContentType(List[Alternative]): Option[ContentType]
.
Perhaps we should add a directive for that.
Thanks, I will take a look at that.