Jul-30-2022, 09:42 AM
I'm trying to develop an api using flask but i'm having a server error in post request, i use this simple code
curl -d "uid=asd" -X POST localhost:5000/test
parserTest = reqparse.RequestParser() parserTest.add_argument('uid') class TestPost(Resource): def get(self, uid): return {'success': f'ok {uid}'} # It works def post(self): parseTest = parserTest.parse_args() return {'warn': f'Parse: {parseTest}'} api.add_resource(TestPost, '/test')I tried using this curl requests:
curl -d "uid=asd" -X POST localhost:5000/test
Error:{"message": "The browser (or proxy) sent a request that this server could not understand."}
curl -F "uid=asd" -X POST localhost:5000/testError:{"message": "The browser (or proxy) sent a request that this server could not understand."}