Only assume GET if no data, otherwise POST (#43133)

* Only assume GET if no data, otherwise POST. Fixes #42876 #43091 #42750
This commit is contained in:
Matt Martz 2018-07-23 09:30:10 -05:00 committed by Toshio Kuratomi
parent 0b77262288
commit 8d933928d2
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- urls - Only assume GET method if data is empty, otherwise POST

View file

@ -1136,7 +1136,7 @@ def open_url(url, data=None, headers=None, method=None, use_proxy=True,
Does not require the module environment Does not require the module environment
''' '''
method = method or 'GET' method = method or ('POST' if data else 'GET')
return Request().open(method, url, data=data, headers=headers, use_proxy=use_proxy, return Request().open(method, url, data=data, headers=headers, use_proxy=use_proxy,
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs, force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
url_username=url_username, url_password=url_password, http_agent=http_agent, url_username=url_username, url_password=url_password, http_agent=http_agent,