title: Spray authorized directive not working as expected?
body: <p>I'm very new to Spray, so I'm guessing this is just me not correctly understanding how the framework works. However, I'm encountering what seems to be weird behavior when trying to handle. This issue references <a href="http://spray.io/documentation/1.2.3/spray-routing/security-directives/authorize/" rel="nofollow">this documentation on directives</a> specifically, but it might apply to other custom directives as well.</p>
  
  <p>When I attempt to utilize the <code>authorize</code> directive that Spray ships with, the HTTP response appears correctly according to the returned value. That is, I get a 403 Forbidden when the returned value of <code>authorize</code> is <code>false</code>, and I get 200 OK when it is instead <code>true</code>. However, it seems as though the function passed to it still executes even though it seems like it shouldn't.</p>
  
  <p>Please see <a href="https://github.com/rkoval/spray-test-directive" rel="nofollow">this SBT project</a> that I created to test this. It demonstrates my issue exactly, so, hopefully, it's helpful in addressing my concern. Run with:</p>
  
  <pre><code>sbt test
  </code></pre>
  
  <p>The output you should see by default should be very similar to the following:</p>
  
  <pre><code>[info] Test:
  [info] route
  [info] - should succeed and have side effects
  [info] - should fail and not have side effects *** FAILED ***
  [info]   1 did not equal 0 (Test.scala:28)
  [info] Run completed in 779 milliseconds.
  [info] Total number of tests run: 2
  [info] Suites: completed 1, aborted 0
  [info] Tests: succeeded 1, failed 1, canceled 0, ignored 0, pending 0
  [info] *** 1 TEST FAILED ***
  </code></pre>
  
  <p>Again, my concern is this: why is the body of the function passed into the <code>Directive0</code> of <code>authorized</code> executed even when the request is getting rejected?</p>
  
  <p>(Apologies if this is a duplicate. I wasn't able to find a similar issue elsewhere here, but kindly close this issue if you can find one)</p>