akka/akka-http

Wrong Marshalling when Entity is `Optional`

Aberta

#559 aberto em 20 de nov. de 2016

 (11 comentários) (0 reação) (0 responsável)Scala (598 forks)batch import
1 - triagedhelp wantedt:routing

Métricas do repositório

Stars
 (1.311 estrelas)
Métricas de merge de PR
 (Mesclagem média 1d 10h) (2 fundiu PRs em 30d)

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

Guia do colaborador