mardi 20 janvier 2015

Flask test_client removes query string parameters

I am using Flask to create a couple of very simple services. From outside testing (using HTTPie) parameters through querystring are getting to the service. But if I am using something like.



data = {
'param1': 'somevalue1',
'param2': 'somevalue2'}

response = self.client.get(url_for("api.my-service", **data))


I can see the correct URI being created:


http://localhost:5000/api1.0/my-service?param1=somevalue1&param2=somevalue2


when I breakpoint into the service:


request.args


is actually empty.


self.client is created by calling app.test_client() on my configured Flask application.


Anyone has any idea why anything after ? is being thrown away or how to work around it while still using test_client?


Thank you.


Aucun commentaire:

Enregistrer un commentaire