title: Python 3 Flask Rest Api: "request.get_json()" gives TypeError: 'NoneType' object is not subscriptable
body: <p>I am creating a route in python flask which will server as rest api to register a user.
  when I try to get json data passed through postman in POST method, I get error <strong>TypeError: 'NoneType' object is not subscriptable</strong> </p>
  
  <p>my request from postman:
  <a href="http://127.0.0.1:5000/register" rel="nofollow noreferrer">http://127.0.0.1:5000/register</a>
  <br/><br/>raw input: {"username":"alok","password":"1234"}</p>
  
  <p>my route and function:<br/> <br/></p>
  
  <pre><code>@app.route('/register', methods=['GET', 'POST'])
  def signup_user():
      data = request.get_json()
      return data['username']
  </code></pre>
  
  <p>As per my knowledge above function should return : "<strong>alok</strong>" </p>
  
  <p>but i get error: <strong>TypeError: 'NoneType' object is not subscriptable</strong> </p>
  
  <p>Any help will be appreciated</p>