Skip to content
Myr

Merge remote-tracking branch 'origin/master'

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parents afa7594, 6e52b5f · Browse files · 2 files+13 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

2 files+13 added−4 removed

  • other:+13 added−4 removed

2 files+13 added−4 removed

modified:requests/models.py+5 added-4 removed
322 unmodified lines
323 # Support for unicode domain names and paths.324 scheme, auth, host, port, path, query, fragment = parse_url(url)325326 if not scheme:327 raise MissingSchema("Invalid URL %r: No schema supplied" % url)327 raise MissingSchema("Invalid URL {0!r}: No schema supplied. "328 "Perhaps you meant http://{0}?".format(url))329330 if not host:331 raise InvalidURL("Invalid URL %r: No host supplied" % url)332
74 unmodified lines
407 if files:408 raise NotImplementedError('Streamed bodies and files are mutually exclusive.')409410 if length is not None:410 self.headers['Content-Length'] = str(length)411 self.headers['Content-Length'] = builtin_str(length)412 else:413 self.headers['Transfer-Encoding'] = 'chunked'414 else:415 # Multi-part file uploads.
17 unmodified lines
433434 def prepare_content_length(self, body):435 if hasattr(body, 'seek') and hasattr(body, 'tell'):436 body.seek(0, 2)436 self.headers['Content-Length'] = str(body.tell())437 self.headers['Content-Length'] = builtin_str(body.tell())438 body.seek(0, 0)439 elif body is not None:440 l = super_len(body)441 if l:441 self.headers['Content-Length'] = str(l)442 self.headers['Content-Length'] = builtin_str(l)443 elif self.method not in ('GET', 'HEAD'):444 self.headers['Content-Length'] = '0'445446 def prepare_auth(self, auth, url=''):
288 unmodified lines
modified:test_requests.py+8 added
682 unmodified lines
683 p = r.prepare()684685 self.assertTrue('multipart/form-data' in p.headers['Content-Type'])686687 def test_autoset_header_values_are_native(self):688 data = 'this is a string'689 length = '16'690 req = requests.Request('POST', httpbin('post'), data=data)691 p = req.prepare()692693 self.assertEqual(p.headers['Content-Length'], length)694695696class TestContentEncodingDetection(unittest.TestCase):697698 def test_none(self):699 encodings = requests.utils.get_encodings_from_content('')
207 unmodified lines