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

貢獻者指南