# Content negotiation with streaming response

**URL:** <https://discuss.akka.io/t/content-negotiation-with-streaming-response/4621>\
**Category:** Akka HTTP\
**Created:** [July 15, 2019, 2:36pm UTC](https://discuss.akka.io/t/content-negotiation-with-streaming-response/4621 "2019-07-15T14:36:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![balhoff](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/balhoff/32/1527_2.png) [@balhoff](https://discuss.akka.io/u/balhoff)\
**Post date:** [July 15, 2019, 2:36pm UTC](https://discuss.akka.io/t/content-negotiation-with-streaming-response/4621/1 "2019-07-15T14:36:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [July 16, 2019, 7:50am UTC](https://discuss.akka.io/t/content-negotiation-with-streaming-response/4621/2 "2019-07-16T07:50:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![balhoff](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/balhoff/32/1527_2.png) [@balhoff](https://discuss.akka.io/u/balhoff)\
**Post date:** [July 16, 2019, 5:29pm UTC](https://discuss.akka.io/t/content-negotiation-with-streaming-response/4621/3 "2019-07-16T17:29:07Z")

</div>

Thanks, I will take a look at that.
