Aktualnie testuję swoją aplikację z sugestiami od http://flask.pocoo.org/docs/testing/, ale chciałbym dodać nagłówek do żądania wpisu.Flask and Werkzeug: Testowanie żądania wpisu z niestandardowymi nagłówkami
Moja prośba jest obecnie:
self.app.post('/v0/scenes/test/foo', data=dict(image=(StringIO('fake image'), 'image.png')))
ale chciałbym dodać zawartość MD5 do wniosku. czy to możliwe?
Moje badania:
Kolba klienta (w kolbie/testing.py) rozciąga Client Werkzeug'S, udokumentowany tutaj: http://werkzeug.pocoo.org/docs/test/
Jak widać, post
używa open
. Ale open
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 mogę jednak uzyskać taką funkcję?