using test_client and sending a request like so:
app = Flask(__name__)
client = app.test_client()
headers = {'content-type': 'application/json', 'Authorization': u'Bearer fake_token_123'}
params = {'dont_care': True}
client.get(ֿֿ'/my_route/123', query_string=params, headers=headers)
my route is
class MyController(Resource):
def get(self, id):
parser = reqparse.RequestParser()
parser.add_argument('currency', type=str, default='USD', help="help text")
args = parser.parse_args()
currency_from_params = args.currency
parser.parse_args() failing for
The browser (or proxy) sent a request that this server could not understand
when removing 'content-type': 'application/json' from header it works.
I don't understand this behaviour, and how do I protect against it without the un elegant try, expect.
Thanks for your help