mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
added unicode strings
This commit is contained in:
committed by
Shivaram Lingamneni
parent
0a7d98871c
commit
3288426f2b
+1
-1
@@ -348,7 +348,7 @@ class Request(object):
|
||||
else:
|
||||
fn = guess_filename(v) or k
|
||||
fp = v
|
||||
if isinstance(fp, bytes):
|
||||
if isinstance(fp, (bytes, str)):
|
||||
fp = StringIO(fp)
|
||||
fields.update({k: (fn, fp.read())})
|
||||
|
||||
|
||||
@@ -344,6 +344,15 @@ class RequestsTestSuite(TestSetup, TestBaseMixin, unittest.TestCase):
|
||||
post3 = post(url, files={'fname.txt': 'fdata', 'fname2.txt':open(__file__,'rb')})
|
||||
self.assertEqual(post3.status_code, 200)
|
||||
|
||||
post4 = post(url, files={'fname.txt': u'fdata'})
|
||||
self.assertEqual(post4.status_code, 200)
|
||||
|
||||
post5 = post(url, files={'file': ('file.txt', 'more fdata')})
|
||||
self.assertEqual(post5.status_code, 200)
|
||||
|
||||
post6 = post(url, files={'fname.txt': u'\xe9'})
|
||||
self.assertEqual(post6.status_code, 200)
|
||||
|
||||
def test_nonzero_evaluation(self):
|
||||
|
||||
for service in SERVICES:
|
||||
|
||||
Reference in New Issue
Block a user