mardi 1 septembre 2015

Setting header on test client doesn't seem to work

I am trying to set the header 'Authorization': 'Bearer foo'. However, when debugging the app in PyCharm's debugger, I can't find anything in the request that shows that the header was set. When I use Postman to send the request, the header does show up. How do I send the headers correctly in Flask's test client?

headers = {'Authorization': 'Bearer foo'}
test_response = self.app.post('/api_endpoint', headers=headers, data=dict(foo=bar))

Aucun commentaire:

Enregistrer un commentaire