title: Flask - custom decorator breaks the routing
body: <p>I have the following Flask routes and a custom helper:</p>
  
  <pre><code>from spots import app, db
  from flask import Response
  import simplejson as json
  
  
  def json_response(action_func):
      def create_json_response(*args, **kwargs):
          ret = action_func(*args, **kwargs)
          code = 200
          if len(ret) == 2:
              code = ret[0]
              resp = ret[1]
          else:
              resp = ret[0]
          return Response(
              response=json.dumps(resp, indent=4),
              status=code,
              content_type='application/json'
          )
  
      return create_json_response
  
  
  @app.route('/test')
  @json_response
  def test():
      return 400, dict(result="Test success")
  
  
  @app.route('/')
  @json_response
  def home():
      return 200, dict(result="Home success")
  </code></pre>
  
  <p>I would expect a GET request to /test to return something like <code>{"result":"Test success"}</code> but that is not the case. Instead, any request seems to match the last route, i.e. <code>home</code>. Why?</p>
  
  <p>I wonder if this is caused by some lack of insulation between the different calls to <code>json_response</code>?</p>
  
  <p>Thanks in advance.</p>