Skip to content
Myr

Merge pull request #2821 from Lukasa/issue/2818

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Allow non-native-string method names.

authored by Cory Benfield · committed by Cory Benfield · parents 978a89d, 2df3c7c · Browse files · 3 files+12 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+12 added−4 removed

  • other:+12 added−4 removed

3 files+12 added−4 removed

modified:requests/models.py+1 added-1 removed
317 unmodified lines
318 def prepare_method(self, method):319 """Prepares the given HTTP method."""320 self.method = method321 if self.method is not None:322 self.method = self.method.upper()322 self.method = to_native_string(self.method.upper())323324 def prepare_url(self, url, params):325 """Prepares the given HTTP URL."""326 #: Accept objects that have string representations.
522 unmodified lines
modified:requests/sessions.py-3 removed
436 unmodified lines
437 A CA_BUNDLE path can also be provided.438 :param cert: (optional) if String, path to ssl client cert file (.pem).439 If Tuple, ('cert', 'key') pair.440 """441442 method = to_native_string(method)443441 # Create the Request.442 req = Request(443 method = method.upper(),444 url = url,
236 unmodified lines
modified:test_requests.py+11 added
566 unmodified lines
567 r = requests.request(568 method=u('POST'), url=httpbin('post'), files=files)569 assert r.status_code == 200570571 def test_unicode_method_name_with_request_object(self):572 files = {'file': open('test_requests.py', 'rb')}573 s = requests.Session()574 req = requests.Request(u("POST"), httpbin('post'), files=files)575 prep = s.prepare_request(req)576 assert isinstance(prep.method, builtin_str)577 assert prep.method == "POST"578579 resp = s.send(prep)580 assert resp.status_code == 200581582 def test_custom_content_type(self):583 r = requests.post(584 httpbin('post'),585 data={'stuff': json.dumps({'a': 123})},
1140 unmodified lines