How to send requests with JSON in unit tests

Changing the post to

response=self.app.post('/test_function', 
                       data=json.dumps(dict(foo='bar')),
                       content_type="application/json")

fixed it.

Thanks to user3012759.

Leave a Comment