Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion requests/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from collections import Mapping
from datetime import datetime

from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse
from .compat import cookielib, OrderedDict, urljoin, urlparse, urlunparse, builtin_str
from .cookies import cookiejar_from_dict, extract_cookies_to_jar, RequestsCookieJar
from .models import Request, PreparedRequest
from .hooks import default_hooks, dispatch_hook
Expand Down Expand Up @@ -309,6 +309,9 @@ def request(self, method, url,
:param cert: (optional) if String, path to ssl client cert file (.pem).
If Tuple, ('cert', 'key') pair.
"""

method = builtin_str(method)

# Create the Request.
req = Request(
method = method.upper(),
Expand Down
5 changes: 5 additions & 0 deletions test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ def test_unicode_multipart_post_fieldnames(self):
prep = r.prepare()
assert b'name="stuff"' in prep.body
assert b'name="b\'stuff\'"' not in prep.body

def test_unicode_method_name(self):
files = {'file': open('test_requests.py', 'rb')}
r = requests.request(method=u'POST', url=httpbin('post'), files=files)
assert r.status_code == 200

def test_custom_content_type(self):
r = requests.post(httpbin('post'),
Expand Down