scalaintellij-ideasprayspray-test

Adding headers in a Spray.io Test Spec fails to send the request into the route


I'm on Spray 1.3.3. I have a spec that looks like the following:

"Add a collection using a PATCH with correct update hash" in {
  Patch("/datastore/collections/FMI", CollectionPatch(addPriceCodes =
    Some(List(PriceCode("AMI", "22", None))))) ~>
    addHeader(hashHeader, updateHash) ~> routes ~> check {
    status should equal(Accepted)
  }
}

This looks like it should in the documentation I've seen, and it compiles, but when I run it, I get a 500 back. If I set a breakpoint in the route, I don't ever get inside of it (where I do in other test functions that don't add a header). In IntelliJ I get an error saying it can't resolve the symbol ~> between the addHeader and routes.

What's the right way to add in a header to send to the route?


Solution

  • Turns out what I have listed above works fine. I was getting into my route and was looking at the wrong thing in the exception backtrace.