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 合并指标
 (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)

贡献者指南