diff options
| author | Craig de Stigter | 2013-05-18 10:23:26 +0200 |
|---|---|---|
| committer | Craig de Stigter | 2013-05-18 10:23:26 +0200 |
| commit | c56d5f8f63673e2d0235015e67d78f8e0e1d7550 (patch) | |
| tree | bf96abef843accae2439413de45095de2995f473 /rest_framework/request.py | |
| parent | 84be169353f0dd2ceb06fe459b72aa2452fcbeb5 (diff) | |
| parent | 34776da9249a5d73f822b3562bc56a5674b10ac7 (diff) | |
| download | django-rest-framework-c56d5f8f63673e2d0235015e67d78f8e0e1d7550.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'rest_framework/request.py')
| -rw-r--r-- | rest_framework/request.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/rest_framework/request.py b/rest_framework/request.py index 3e2fbd88..a434659c 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -1,11 +1,10 @@ """ -The :mod:`request` module provides a :class:`Request` class used to wrap the standard `request` -object received in all the views. +The Request class is used as a wrapper around the standard request object. The wrapped request then offers a richer API, in particular : - content automatically parsed according to `Content-Type` header, - and available as :meth:`.DATA<Request.DATA>` + and available as `request.DATA` - full support of PUT method, including support for file uploads - form overloading of HTTP method, content type and content """ @@ -231,11 +230,17 @@ class Request(object): """ self._content_type = self.META.get('HTTP_CONTENT_TYPE', self.META.get('CONTENT_TYPE', '')) + self._perform_form_overloading() - # if the HTTP method was not overloaded, we take the raw HTTP method + if not _hasattr(self, '_method'): self._method = self._request.method + if self._method == 'POST': + # Allow X-HTTP-METHOD-OVERRIDE header + self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE', + self._method) + def _load_stream(self): """ Return the content body of the request, as a stream. |
