title: Error when check request.method in flask
body: <p>I am currently learning Flask.</p>
  
  <p>After sending data through <code>$.ajax()</code> with jQuery, <code>type='post'</code> the server side gives an error when I check <code>request.method</code>. The same occurs with <code>type='get'</code>.</p>
  
  <p><strong>error</strong></p>
  
  <pre><code>builtins.ValueError
  ValueError: View function did not return a response
  
  Traceback (most recent call last)
    File "C:\Python33\lib\site-packages\flask\app.py", line 1836, in __call__
      return self.wsgi_app(environ, start_response)
    File "C:\Python33\lib\site-packages\flask\app.py", line 1820, in wsgi_app
      response = self.make_response(self.handle_exception(e))
    File "C:\Python33\lib\site-packages\flask\app.py", line 1403, in handle_exception
      reraise(exc_type, exc_value, tb)
    File "C:\Python33\lib\site-packages\flask\_compat.py", line 33, in reraise 
      raise value 
    File "C:\Python33\lib\site-packages\flask\app.py", line 1817, in wsgi_app
      response = self.full_dispatch_request()
    File "C:\Python33\lib\site-packages\flask\app.py", line 1478, in full_dispatch_request
      response = self.make_response(rv)
    File "C:\Python33\lib\site-packages\flask\app.py", line 1566, in make_response
      raise ValueError('View function did not return a response')
  ValueError: View function did not return a response
  </code></pre>
  
  <p><strong>python code</strong></p>
  
  <pre><code>if request.method=='psot': #**Error occur when i check**
      req = request.get_json()
      ck=query_db("select * from users where username=?",[req['u']])
      if ck:
          if check_password_hash(ck[0]['password'],req['p']):
              session['username']=req['u']
              return jsonify({'result':'1234'})
          else:
              return jsonify({'result':'noo'})
      else:
              return jsonify({'result':'noo'})
  </code></pre>
  
  <p><strong>jquery</strong></p>
  
  <pre><code>$.ajax({
      type:'post',
      contentType: 'application/json',
      url:"/login",
      data:JSON.stringify({'u':luser.val(),'p':lpass.val()}),
      dataType:'json',
      success:function(data)
      {
          if(data.result=='1234')
          {
              window.location.href='/profile';
          }
          else
          {
              $('#log3s').html('username or password not correct').css('color','red');
              return false;
          }
      }
  });
  </code></pre>