title: How can I simulate a POST request with a json body in SprayTest?
body: <p>If I have an endpoint that unmarshalls json like this:</p>
  
  <pre><code>(path("signup")&amp; post) {
      entity(as[Credentials]) { credentials =&gt;
      …
  </code></pre>
  
  <p>How can I test that with a Spray test spec:</p>
  
  <pre><code>"The Authentication service" should {
  
  "create a new account if none exists" in {
     Post("/api/authentication/signup", """{"email":"foo", "password":"foo:" }""") ~&gt; authenticationRoute ~&gt; check {
      handled === true
    }
  }
  }
  </code></pre>
  
  <p>That obviously doesn't work for several reasons. What would be the correct way?</p>