Skip to content
Myr

properly handle send(prefetch=False)

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

fixes RequestsTestSuite.test_prefetch_return_response_interaction

authored by Shivaram Lingamneni · committed by Shivaram Lingamneni · parent 857d8ed · Browse files · 1 file+7 added−2 removed
This commit

State

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

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:requests/models.py+7 added-2 removed
456 unmodified lines
457 return True458 except ValueError:459 return False460461 def send(self, anyway=False, prefetch=True):461 def send(self, anyway=False, prefetch=None):462 """Sends the request. Returns True if successful, False if not.463 If there was an HTTPError during transmission,464 self.response.status_code will contain the HTTPError code.465466 Once a request is successfully sent, `sent` will equal True.467468 :param anyway: If True, request will be sent, even if it has469 already been sent.470471 :param prefetch: If not None, will override the request's own setting472 for prefetch.473 """474475 # Build the URL476 url = self.full_url
151 unmodified lines
628 r = dispatch_hook('post_request', self.hooks, self)629 self.__dict__.update(r.__dict__)630631 # If prefetch is True, mark content as consumed.629 if prefetch or self.prefetch:632 if prefetch is None:633 prefetch = self.prefetch634 if prefetch:635 # Save the response.636 self.response.content637638 if self.config.get('danger_mode'):
212 unmodified lines