akka/akka-http

Marshaller.withFixedContentType doesn't seem to work

オープン

#1,077 opened on 2017/05/02

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)Scala (598 件のフォーク)batch import
1 - triagedbughelp wantedt:docst:marshalling

Repository metrics

Stars
 (1,311 個のスター)
PR merge metrics
 (平均マージ 1d 10h) (30d で 2 merged PRs)

説明

When I create a ToEntityMarshaller for a type with Marshaller.withFixedContentType, as so:

  case class SomeType2(content: String)

  implicit val st2AsCsv: ToEntityMarshaller[SomeType2] =
    Marshaller.withFixedContentType(ContentTypes.`text/csv(UTF-8)`)(_.content)

the response is still returning Content-Type: text/plain; charset=UTF-8. Using Marshaller.StringMarshaller.wrap works, though.

  case class SomeType1(content: String)

  implicit val st1AsCsv: ToEntityMarshaller[SomeType1] =
    Marshaller.StringMarshaller.wrap(MediaTypes.`text/csv`)(_.content)

Here's a minimal example to reproduce: https://gist.github.com/chadselph/9149bab77c7aebfcea24bc15c9b82495

I've only tested this on 10.0.5, am I doing something wrong or is this a bug?

コントリビューターガイド