File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,26 @@ other headless browsers).
139
139
assert res.code == 200
140
140
141
141
142
+ ``request_ctx `` - request context
143
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144
+
145
+ The request context which contains all request relevant information.
146
+
147
+ .. hint ::
148
+
149
+ The request context has been pushed implicitly any time the ``app ``
150
+ fixture is applied and is kept around during test execution, so it's easy
151
+ to introspect the data:
152
+
153
+ .. code :: python
154
+
155
+ from flask import request, url_for
156
+
157
+ def test_request_headers (client ):
158
+ res = client.get(url_for(' ping' ), headers = [(' X-Something' , ' 42' )])
159
+ assert request.headers[' X-Something' ] == ' 42'
160
+
161
+
142
162
Content negotiation
143
163
~~~~~~~~~~~~~~~~~~~
144
164
Original file line number Diff line number Diff line change 17
17
- ``config`` - you application config,
18
18
- ``live_server`` - runs an application in the background (useful for tests
19
19
with `Selenium <http://www.seleniumhq.org>`_ and other headless browsers),
20
+ - ``request_ctx`` - the request context,
20
21
- ``accept_json``, ``accept_jsonp``, ``accept_any`` - accept headers
21
22
suitable to use as parameters in ``client``.
22
23
You can’t perform that action at this time.
0 commit comments