diff options
| author | Sergey Schetinin <sergey@maluke.com> | 2011-06-02 02:09:57 +0300 |
|---|---|---|
| committer | Sergey Schetinin <sergey@maluke.com> | 2011-06-02 02:09:57 +0300 |
| commit | fa3834b1ed35cc7cf8e43fc6bde4dd4ff4df30bd (patch) | |
| tree | a494cc9e9e71a889e20497dc8b767df1f350aca8 /tests/test_request_nose.py | |
| parent | e6dac6f32c707a1a1299e87b45cf9a7ef840bcf6 (diff) | |
| download | webob-fa3834b1ed35cc7cf8e43fc6bde4dd4ff4df30bd.tar.gz | |
* enhance the req.is_body_readable to always guess GET, HEAD, DELETE and TRACE as unreadable and PUT and POST as readable
* deny setting req.body or req.body_file to non-empty values for GET, HEAD and other bodiless requests
* see also: https://bitbucket.org/ianb/webob/issue/12
Diffstat (limited to 'tests/test_request_nose.py')
| -rw-r--r-- | tests/test_request_nose.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_request_nose.py b/tests/test_request_nose.py index 172c1de..b6a5b63 100644 --- a/tests/test_request_nose.py +++ b/tests/test_request_nose.py @@ -2,11 +2,17 @@ from webob import Request def test_request_read_no_content_length(): - req, input = _make_read_tracked_request('abc') + req, input = _make_read_tracked_request('abc', 'FOO') assert req.content_length is None assert req.body == '' assert not input.was_read +def test_request_read_no_content_length_POST(): + req, input = _make_read_tracked_request('abc', 'POST') + assert req.content_length is None + assert req.body == 'abc' + assert input.was_read + def test_request_read_no_flag_but_content_length_is_present(): req, input = _make_read_tracked_request('abc') req.content_length = 3 @@ -31,10 +37,10 @@ def test_request_read_after_setting_body_file(): assert input.was_read -def _make_read_tracked_request(data=''): +def _make_read_tracked_request(data='', method='PUT'): input = ReadTracker(data) env = { - 'HTTP_METHOD': 'PUT', + 'REQUEST_METHOD': method, 'wsgi.input': input, } return Request(env), input |
