akka/akka-http

Wrong Marshalling when Entity is `Optional`

Ouverte

#559 ouverte le 20 nov. 2016

 (11 commentaires) (0 réaction) (0 personne assignée)Scala (598 forks)batch import
1 - triagedhelp wantedt:routing

Métriques du dépôt

Stars
 (1 311 étoiles)
Métriques de merge PR
 (Merge moyen 1j 10h) (2 PRs mergées en 30 j)

Description

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

Guide contributeur