From 104614c600a391b2d416074f3929e543b86a8492 Mon Sep 17 00:00:00 2001 From: Dave Kuhn Date: Mon, 4 Mar 2013 07:14:38 +1100 Subject: [PATCH] Modified to allow form overloading to take precedence over header. --- rest_framework/request.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/rest_framework/request.py b/rest_framework/request.py index 4cdc8b738..f26d934d7 100644 --- a/rest_framework/request.py +++ b/rest_framework/request.py @@ -232,15 +232,12 @@ class Request(object): self._content_type = self.META.get('HTTP_CONTENT_TYPE', self.META.get('CONTENT_TYPE', '')) - # Look for method override in header - self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE', None) - if self._method: - return - self._perform_form_overloading() - # if the HTTP method was not overloaded, we take the raw HTTP method - if self._method: - self._method = self._request.method + if not _hasattr(self, '_method'): + # Method wasn't overloaded by hidden form element, so look for + # method override in header. If not present default to raw HTTP method + self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE', + self._request.method) def _load_stream(self): """