title: curl send post request for Flask python app failed
body: <p>The following is my Flask app code,which is very basic:</p>
  
  <pre><code>from models import Base, User
  from flask import Flask, jsonify, request, url_for, abort
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy.orm import relationship, sessionmaker
  from sqlalchemy import create_engine
  
  from flask import Flask
  
  engine = create_engine('sqlite:///users.db')
  
  Base.metadata.bind = engine
  DBSession = sessionmaker(bind=engine)
  session = DBSession()
  app = Flask(__name__)
  
  @app.route('/api/users', methods = ['POST'])
  def new_user():
      username = request.json.get('username')
      password = request.json.get('password')
      print username
      print password
  
  
  
  if __name__ == '__main__':
      app.debug = True
      app.run(host='127.0.0.1', port=5000)
  </code></pre>
  
  <p>and use <code>curl</code> to send HTTP POST request in command line as following:<br>
  <code>curl -i -X POST -H "Content-Type: application/json" -d '{"username":"abc","password":"123"}' http://localhost:5000/api/users</code><br></p>
  
  <p>but get error of <code>400 BAD REQUEST</code></p>
  
  <p>BTW, I run this app in windows cmd. </p>
  
  <p>any help will be welcomed, thanks in advance. </p>
  
  <p>EDIT:<br>
  after debugging, after the issue comes from </p>
  
  <pre><code>username = request.json.get('username')
  password = request.json.get('password')
  </code></pre>
  
  <p>these two command. If comment out the above two lines, the curl request can success. But still don't know the reason</p>
  
  <p><a href="https://i.stack.imgur.com/QTzvj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QTzvj.jpg" alt="enter image description here"></a></p>