【发布时间】:2020-03-16 14:35:12
【问题描述】:
我正在尝试在我的 akka http 测试中解组 csv 下载:
val bseq: immutable.Seq[ByteString] = Await.result(response.entity.dataBytes.runWith(Sink.seq), 20 seconds)
val str = bseq.map(_.utf8String).mkString
logger.debug(s"res:${str}")
但我明白了:
akka.http.scaladsl.marshalling.NoStrictlyCompatibleElementMarshallingAvailableException: None of the available marshallings (List(WithFixedContentType(application/octet-stream,<function0>))) directly match the ContentType requested by the top-level streamed entity (text/csv; charset=UTF-8). Please provide an implicit `Marshaller[akka.util.ByteString, HttpEntity]` that can render akka.util.ByteString as [text/csv; charset=UTF-8]
at akka.http.scaladsl.marshalling.LowPriorityToResponseMarshallerImplicits$$anonfun$fromEntityStreamingSupportAndByteStringSourceMarshaller$1$$anonfun$apply$5$$anonfun$4$$anonfun$6$$anonfun$apply$7.apply(PredefinedToResponseMarshallers.scala:117)
如何在我的测试用例中解组 csv 文件?
【问题讨论】: