Dears, have an issue. When posting an axios request to flask server with a parameter, the parameter is not received by flask.
Axios : 0.18 React : 16.3.2 Redux : 4
Here is code where the issue is located:
confirm: token =>
axios
.post("/api/auth/confirmation", { token })
.then(res => res.data.user),
the variable token is not empty. Even if replace it by a fix value (e.g 2323232), I get a 405 response form API
axios
.post("/api/auth/confirmation", "2323232")
.then(res => res.data.user),
the flask servers responds status 405, because in fact it receives the url, but not the value of the parameter:
127.0.0.1 - - [24/May/2018 16:21:14] "POST /api/auth/confirmation HTTP/1.1" 405 -
But if the value is included in the URL, then there is no issue:
axios
.post("/api/auth/confirmation/2323232")
.then(res => res.data.user),
result is fine :
127.0.0.1 - - [24/May/2018 16:04:01] "POST /api/auth/confirmation/2323232 HTTP/1.1" 200 -
What am I doing wrong here ?
thks & Rgds
Ps : flask backend code is very simple:
@app.route('/api/auth/confirmation/<token>',methods=['POST'])
def confirmation(token):
return jsonify({'user':'ok'}),200