mirror of https://github.com/scrapy/scrapy.git
Refactor conditions on body producer
This commit is contained in:
parent
99e3c0d653
commit
97fc68fa16
|
|
@ -279,8 +279,10 @@ class ScrapyAgent(object):
|
|||
headers.removeHeader(b'Proxy-Authorization')
|
||||
if request.body:
|
||||
bodyproducer = _RequestBodyProducer(request.body)
|
||||
elif method == b'POST':
|
||||
bodyproducer = _RequestBodyProducer(b'')
|
||||
else:
|
||||
bodyproducer = _RequestBodyProducer(b'') if method == b'POST' else None
|
||||
bodyproducer = None
|
||||
start_time = time()
|
||||
d = agent.request(
|
||||
method, to_bytes(url, encoding='ascii'), headers, bodyproducer)
|
||||
|
|
|
|||
Loading…
Reference in New Issue