akka/akka-http

Wrong Marshalling when Entity is `Optional`

Offen

#559 geöffnet am 20.11.2016

 (11 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Scala (598 Forks)batch import
1 - triagedhelp wantedt:routing

Repository-Metriken

Stars
 (1.311 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 1T 10h) (2 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide