Flask i Werkzeug: Testowanie żądania pocztowego za pomocą niestandardowych nagłówków
Obecnie testuję moją aplikację za pomocą sugestiihttp://flask.pocoo.org/docs/testing/, ale chciałbym dodać nagłówek do żądania pocztowego.
Moja prośba jest obecnie:
self.app.post('/v0/scenes/test/foo', data=dict(image=(StringIO('fake image'), 'image.png')))
ale chciałbym dodać treść-md5 do żądania. czy to możliwe?
Moje badania:
Klient Flask (w kolbie / testing.py) rozszerza dokumentację klienta Werkzeug, udokumentowaną tutaj:http://werkzeug.pocoo.org/docs/test/
Jak widzisz,post
używaopen
. Aleopen
ma tylko:
Parameters:
as_tuple – Returns a tuple in the form (environ, result)
buffered – Set this to True to buffer the application run. This will automatically close the application for you as well.
follow_redirects – Set this to True if the Client should follow HTTP redirects.
Wygląda na to, że nie jest obsługiwany. Jak jednak uzyskać taką funkcjonalność?