mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	always obey X-HTTP-METHOD-OVERRIDE header
required to support old flash/flex clients that need to do everything as GET requests (apparently to allow for any error handlings)
This commit is contained in:
		
							parent
							
								
									f92d8bd972
								
							
						
					
					
						commit
						58d77c11c3
					
				| 
						 | 
					@ -279,7 +279,6 @@ class Request(object):
 | 
				
			||||||
        if not _hasattr(self, '_method'):
 | 
					        if not _hasattr(self, '_method'):
 | 
				
			||||||
            self._method = self._request.method
 | 
					            self._method = self._request.method
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if self._method == 'POST':
 | 
					 | 
				
			||||||
            # Allow X-HTTP-METHOD-OVERRIDE header
 | 
					            # Allow X-HTTP-METHOD-OVERRIDE header
 | 
				
			||||||
            self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE',
 | 
					            self._method = self.META.get('HTTP_X_HTTP_METHOD_OVERRIDE',
 | 
				
			||||||
                                         self._method)
 | 
					                                         self._method)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,6 +66,9 @@ class TestMethodOverloading(TestCase):
 | 
				
			||||||
        request = Request(factory.post('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
 | 
					        request = Request(factory.post('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
 | 
				
			||||||
        self.assertEqual(request.method, 'DELETE')
 | 
					        self.assertEqual(request.method, 'DELETE')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        request = Request(factory.get('/', {'foo': 'bar'}, HTTP_X_HTTP_METHOD_OVERRIDE='DELETE'))
 | 
				
			||||||
 | 
					        self.assertEqual(request.method, 'DELETE')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestContentParsing(TestCase):
 | 
					class TestContentParsing(TestCase):
 | 
				
			||||||
    def test_standard_behaviour_determines_no_content_GET(self):
 | 
					    def test_standard_behaviour_determines_no_content_GET(self):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user