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

* Only assume GET if no data, otherwise POST. Fixes #42876 #43091 #42750
pull/43151/head
Matt Martz 6 years ago committed by Toshio Kuratomi
parent 0b77262288
commit 8d933928d2

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

@ -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,

Loading…
Cancel
Save