From 97fc68fa1699b1c782c6e6d888e21d995bdf071d Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Mon, 24 Apr 2017 22:08:39 +0200 Subject: [PATCH] Refactor conditions on body producer --- scrapy/core/downloader/handlers/http11.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scrapy/core/downloader/handlers/http11.py b/scrapy/core/downloader/handlers/http11.py index bff4a30c9..46493f87f 100644 --- a/scrapy/core/downloader/handlers/http11.py +++ b/scrapy/core/downloader/handlers/http11.py @@ -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)