Ticket #17797: django-test-client-PATCH.patch
File django-test-client-PATCH.patch, 1.5 KB (added by , 13 years ago) |
---|
-
django/test/client.py
304 304 r.update(extra) 305 305 return self.request(**r) 306 306 307 def patch(self, path, data={}, content_type=MULTIPART_CONTENT, 308 **extra): 309 "Construct a PATCH request." 310 311 patch_data = self._encode_data(data, content_type) 312 313 parsed = urlparse(path) 314 r = { 315 'CONTENT_LENGTH': len(patch_data), 316 'CONTENT_TYPE': content_type, 317 'PATH_INFO': self._get_path(parsed), 318 'QUERY_STRING': parsed[4], 319 'REQUEST_METHOD': 'PATCH', 320 'wsgi.input': FakePayload(patch_data), 321 } 322 r.update(extra) 323 return self.request(**r) 324 307 325 def delete(self, path, data={}, **extra): 308 326 "Construct a DELETE request." 309 327 … … 479 497 response = self._handle_redirects(response, **extra) 480 498 return response 481 499 500 def patch(self, path, data={}, content_type=MULTIPART_CONTENT, 501 follow=False, **extra): 502 """ 503 Send a resource to the server using PATCH. 504 """ 505 response = super(Client, self).patch(path, data=data, content_type=content_type, **extra) 506 if follow: 507 response = self._handle_redirects(response, **extra) 508 return response 509 482 510 def delete(self, path, data={}, follow=False, **extra): 483 511 """ 484 512 Send a DELETE request to the server.