akka/akka-core

JsonObjectParser rejects some valid JSON Array streams

開放

#25,673 建立於 2018年9月21日

 (0 則留言) (0 個反應) (0 位負責人)Scala (3,547 個分叉)batch import
3 - in progresshelp wantedt:stream

倉庫指標

星標
 (13,277 顆星)
PR 合併指標
 (平均合併 8天 19小時) (30 天內合併 10 個 PR)

描述

When attempting to feed the following entity:

   [ "abc", "def", "ghi", "klm" ]

(which is a valid JSON Array, even though not of objects) to an Akka HTTP endpoint that specifies the

entity(asSourceOf[String]) { source ⇒ … }

directive, JsonObjectParser fails to parse and provide a Source[ByteString, _] that can be demarshalled as JsValues and eventually strings.

Furthermore, while using the directive for that usage might be slower than using a dedicated framing primitive, it's a bit dangerous that the "obvious path" compiles but fails to work. (incoming PR)

貢獻者指南