akka/akka-http

Wrong Marshalling when Entity is `Optional`

开放

#559 创建于 2016年11月20日

 (11 条评论) (0 个反应) (0 位负责人)Scala (598 个派生)batch import
1 - triagedhelp wantedt:routing

仓库指标

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

描述

When completing a route with a Java Optional the output is not the one I would expect:

Expected Behavior

  • If Optional[T] is empty: completed with an empty Entity
  • If Optional[T] is not empty: completed with proper marshalling of T

Actual Behavior

  • If Optional[T] is empty: completed with {"present": false}
  • If Optional[T] is not empty: completed with {"present": true}

I have a gist where one can reproduce this: https://gist.github.com/jlprat/5e1c27ce4b912e0a3eb0ad56237246d7

贡献者指南