Flask无法识别POST方法

我试图发出发布请求,但出现错误405:不允许的方法。

@app.route('/')
def hello_world():
     return 'Hello World!'



@app.route('/register', methods=['POST'])
def register_user():
    user_info = request.get_json()
    if request.method == 'POST':
        user = User.query.filter_by(username = user_info['username']).first()
        if user is not None:
            return jsonify({"msg":"User already exists!"}), 404
        saved_user = User(username=user_info['username'], password=user_info['password'])
        db.session.add(saved_user)
        db.session.commit()
        return ""
    return "", 200

这是我的要求:

    r = requests.post('https://myapp.herokuapp.com/register',json{'username':'testname','password':'testpsw'})
    assert r.status_code == 200 

if i change it to methods = ['GET', 'POST'] it just does a get.