I need help. I am trying to use CURL to do HTTP POST & use spray routing along with parameters
curl -v -o UAT.json "http://*****/pvdtest1/14-JUL-2014?enriched=true" -H "Content-Type: application/json" -d '{ "text": "Test", "username": "User" }'
My JSON Post is optional, means I can also get request as
curl -v -o UAT.json "http://*****/pvdtest1/14-JUL-2014?enriched=true"
In the routing if I use
path("pvdtest1" / Segment) { (cobDate) =>
(parameters('enriched.as[Boolean] ? false) & post) {
(enriched) => {
println(" inside post")
entity(as[Message]) { message =>
println(" inside post 1")
logger.debug("User '{}' has posted '{}'", message.username, message.text)
above code works file
but if I try to make POST optional, it does not work
path("pvdtest1" / Segment) { (cobDate) =>
(parameters('enriched.as[Boolean] ? false) | post) {
(enriched) => {
println(" inside post")
entity(as[Message]) { message =>
println(" inside post 1")
logger.debug("User '{}' has posted '{}'", message.username, message.text)
Error:(166, 56) type mismatch;
found : spray.routing.Directive0
(which expands to) spray.routing.Directive[shapeless.HNil]
required: spray.routing.Directive[shapeless.HList]
Note: shapeless.HNil <: shapeless.HList, but class Directive is invariant in type L.
You may wish to define L as +L instead. (SLS 4.5)
(parameters('enriched.as[Boolean] ? false) | post) {
Can someone please help in resolving the issue?