Skip to content
Myr

Merge pull request #3108 from kevinburke/flip-conditional

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

Flip conditional in session.send()

authored by Ian Cordasco · committed by Ian Cordasco · parents aa1c3ad, ae1ac2d · Browse files · 2 files+9 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+9 added−1 removed

  • tests:+8 added−0 removed
  • other:+1 added−1 removed

2 files+9 added−1 removed

modified:requests/sessions.py+1 added-1 removed
555 unmodified lines
556 kwargs.setdefault('proxies', self.proxies)557558 # It's possible that users might accidentally send a Request object.559 # Guard against that specific failure case.560 if not isinstance(request, PreparedRequest):560 if isinstance(request, Request):561 raise ValueError('You can only send PreparedRequests.')562563 # Set up variables needed for resolve_redirects and dispatching of hooks564 allow_redirects = kwargs.pop('allow_redirects', True)
125 unmodified lines
modified:tests/test_requests.py+8 added
636 unmodified lines
637638 resp = s.send(prep)639 assert resp.status_code == 200640641 def test_non_prepared_request_error(self):642 s = requests.Session()643 req = requests.Request(u('POST'), '/')644645 with pytest.raises(ValueError) as e:646 s.send(req)647 assert str(e.value) == 'You can only send PreparedRequests.'648649 def test_custom_content_type(self, httpbin):650 r = requests.post(651 httpbin('post'),652 data={'stuff': json.dumps({'a': 123})},
944 unmodified lines