You need to "seal the route" to see actual status codes. Sealing the route means that the default rejection and exception handlers are used to handle any so far unhandled rejections and exceptions. This automatically done when using runRoute in your service but it isn't done automatically in the testkit...
I think you need an implicit ExecutionContext in scope, to provide the Future marshalling ability.
sender() ! akka.actor.Status.Success akka.actor.status.Success is a case class requiring one argument. Looks like that you've replied not with a class instance, but with a partially-applied Success.apply(_) function, which is not you've planned to do, I believe: case Success(_) => sender() ! akka.actor.Status.Success(storeId) ...
akka,spray,http-method,spray-dsl
No, your code is (almost) correct. The issue is that, in spray, the code that lives in a method matcher but does not live under an extraction (one of the directives "extracting" something, such as "parameters" or "segment") is executed all times. In your case, you correctly match the path...
scala,try-catch,spray,spray-dsl
The way I solved this was do do the following : lazy val myService = new Service() val routes = path("api") { get { complete { handleTry { myService.run() } } } } ~ path("api" / LongNumber) { (num: Long) => get { complete { handleTry { myService.run(num) } }...
scala,spray,spray-json,spray-dsl
You have the RequestContext (ctx) so you can call reject, failWith or any other methods available on the RequestContext. val route = path("entities" / LongNumber) { id => get { produce(instanceOf[MyEntity]) { func => ctx => heavyLookupById(id, func, ctx) } } } def heavyLookupById(id: Long, func: MyEntity => Unit, ctx:...
scala,spray,spray-json,spray-dsl
You can just nest the directives: path("ElevationService" / DoubleNumber / DoubleNumber) { (long, lat) => post { entity(as[ScriveRequest]) { scrive => onSuccess( elevationService ? ElevationService.Process(long, lat, bodyParams) ) { actorReply => complete(actorReply) } } } You can also use & to combine two directives more directly: (path("ElevationService" / DoubleNumber /...