Skip to content
Myr

Added an example of how to postprocess requests in the testing docs.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent ebb65b8 · Browse files · 1 file+14 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+14 added−0 removed

  • other:+14 added−0 removed

1 file+14 added−0 removed

modified:docs/testing.rst+14 added
234 unmodified lines
235236This can be necessary to open database connections or something similar237depending on how your application was designed.238239If you want to call the :meth:`~flask.Flask.after_request` functions you240need to call into :meth:`~flask.Flask.process_response` which however241requires that you pass it a response object::242243 app = flask.Flask(__name__)244245 with app.test_request_context('/?name=Peter'):246 resp = Response('...')247 resp = app.process_response(resp)248 ...249250This in general is less useful because at that point you can directly251start using the test client.252253254Keeping the Context Around255--------------------------256257.. versionadded:: 0.4
18 unmodified lines