title: Response from before_request
body: <p>In my app I am trying to check if user is authorised to access the resource, for example when user requests to url <em>api/proxy</em>.</p>
  
  <p>I use before_request to call checking function</p>
  
  <pre><code> @hook('before_request') 
   def check_permission():
       securityService = SecurityService(db=db)
       try:
           securityService.check_access_permission(request)
       except Exception as e:
          print("excepting")
          return json.dumps({'Error': str(e)})
          // stop execution here
  </code></pre>
  
  <p>The functionality of access checking is tested, I raise exception when access is not granted. Even in server log I can see "excepting". Return statement dont stop the execution process.</p>
  
  <p>But the code dont stop execution and continues to proxy_get function</p>
  
  <pre><code>@get('/api/proxy')
  def proxy_get():
      response = proxyService.get()
      return json.dumps({"Response" : response})
  </code></pre>
  
  <p>Is there any way to stop request handling in before_request function, or am I just messing something up? Whats the proper solution?</p>
  
  <p>How do I set status code to that response? 
  I tried </p>
  
  <pre><code>response.status_code(401)
  </code></pre>
  
  <p>but it didnt work. I was getting error TypeError: 'int' object is not callable</p>