From ce0baf07c0484d7e65b1d93cdd1ec4a1f8fcd60a Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Sun, 24 Mar 2013 12:52:46 +0100 Subject: Allow request headers access in app context. - Give extensions access to request headers in app context. - Implements: blueprint allow-access-to-headers-for-extension. Change-Id: I22bba172a8ceaba9260487666172586c45aa95d4 --- tests/test_wsgi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index 2d81ba86..0cd6a733 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -84,6 +84,17 @@ class ApplicationTest(BaseWSGITest): resp = req.get_response(FakeApp()) self.assertEqual(jsonutils.loads(resp.body), {'1': '2'}) + def test_headers_available(self): + class FakeApp(wsgi.Application): + def index(self, context): + return context['headers'] + + app = FakeApp() + req = self._make_request(url='/?1=2') + req.headers['X-Foo'] = "bar" + resp = req.get_response(app) + self.assertIn('X-Foo', eval(resp.body)) + def test_render_response(self): data = {'attribute': 'value'} body = '{"attribute": "value"}' -- cgit