Skip to content

Commit da0bd63

Browse files
committed
Request is inherited from dict now for making per-request storage to middlewares (#242).
1 parent b084990 commit da0bd63

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGES.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ CHANGES
3535

3636
- Server has 75 seconds keepalive timeout now, was non-keepalive by default.
3737

38-
- Application doesn't accept `**kwargs` anymore (#243).
38+
- Application doesn't accept `**kwargs` anymore (#243).
39+
40+
- Request is inherited from dict now for making per-request storage to
41+
middlewares (#242).
3942

4043

4144
0.13.1 (12-31-2014)

aiohttp/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):
139139
############################################################
140140

141141

142-
class Request(HeadersMixin):
142+
class Request(dict, HeadersMixin):
143143

144144
def __init__(self, app, message, payload, transport, reader, writer, *,
145145
_HOST=hdrs.HOST):

tests/test_web_request.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,9 @@ def test_match_info(self):
161161
match = {'a': 'b'}
162162
req._match_info = match
163163
self.assertIs(match, req.match_info)
164+
165+
def test_request_is_dict(self):
166+
req = self.make_request('GET', '/')
167+
self.assertTrue(isinstance(req, dict))
168+
req['key'] = 'value'
169+
self.assertEqual('value', req['key'])

0 commit comments

Comments
 (0)