Hello, I am new to akka and akka http and need some help with Future serialization.
To keep things simple i have a server with the following endpoints:
get {
path("aa") {
complete(Created -> "bar")
}
} ~
get {
path("bb") {
complete(Created -> JObject( "id" -> JString("anything")))
}
} ~
get {
path("cc") {
complete(Created -> Future {JObject( "id" -> JString("anything"))})
}
}
For the first two cases i am getting exactly what i want:
< HTTP/1.1 201 Created
< Server: akka-http/10.1.1
< Date: Wed, 27 Jun 2018 20:12:53 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 3
<
* Connection #0 to host localhost left intact
bar
< HTTP/1.1 201 Created
< Server: akka-http/10.1.1
< Date: Wed, 27 Jun 2018 20:12:55 GMT
< Content-Type: application/json
< Content-Length: 17
<
* Connection #0 to host localhost left intact
{"id":"anything"}
But with the case with Future:
< HTTP/1.1 200 OK
< Server: akka-http/10.1.1
< Date: Wed, 27 Jun 2018 20:15:03 GMT
< Content-Type: application/json
< Content-Length: 166
<
* Connection #0 to host localhost left intact
{"_1":{"intValue":201,"reason":"Created","defaultMessage":"The request has been fulfilled and resulted in a new resource being created.","allowsEntity":true},"_2":{}}
What I am missing here?
Thx