Skip to content
Myr

added mutlipart file=strings

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

authored by barberj · committed by Shivaram Lingamneni · parent 7b6338c · Browse files · 2 files+18 added−1 removed
This commit

State

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

Diff stats

2 files+18 added−1 removed

  • tests:+15 added−0 removed
  • other:+3 added−1 removed

2 files+18 added−1 removed

modified:requests/models.py+3 added-1 removed
30 unmodified lines
31 stream_decode_response_unicode, get_netrc_auth, get_environ_proxies,32 DEFAULT_CA_BUNDLE_PATH)33from .compat import (34 cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,35 is_py2)35 StringIO, is_py2)3637# Import chardet if it is available.38try:39 import chardet
307 unmodified lines
347 fn, fp = v348 else:349 fn = guess_filename(v) or k350 fp = v351 if isinstance(fp, bytes):352 fp = StringIO(fp)353 fields.update({k: (fn, fp.read())})354355 (body, content_type) = encode_multipart_formdata(fields)356
479 unmodified lines
modified:tests/test_requests.py+15 added
327 unmodified lines
328 headers={'User-Agent': 'requests-tests'})329330 self.assertEqual(post2.status_code, 200)331332 def test_POSTBIN_GET_POST_FILES_STRINGS(self):333334 for service in SERVICES:335336 url = service('post')337338 post1 = post(url, files={'fname.txt': 'fdata'})339 self.assertEqual(post1.status_code, 200)340341 post2 = post(url, files={'fname.txt': 'fdata', 'fname2.txt':'more fdata'})342 self.assertEqual(post2.status_code, 200)343344 post3 = post(url, files={'fname.txt': 'fdata', 'fname2.txt':open(__file__,'rb')})345 self.assertEqual(post3.status_code, 200)346347 def test_nonzero_evaluation(self):348349 for service in SERVICES:350
541 unmodified lines