akka/akka-http

Marshaller.withFixedContentType doesn't seem to work

开放

#1,077 创建于 2017年5月2日

 (4 条评论) (0 个反应) (0 位负责人)Scala (598 个派生)batch import
1 - triagedbughelp wantedt:docst:marshalling

仓库指标

星标
 (1,311 个星标)
PR 合并指标
 (平均合并 1天 10小时) (30 天内合并 2 个 PR)

描述

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?

贡献者指南