Warn when using the deprecated HEADER_ arguments (#20236)

* Make sure the uri module warns about using the deprecated HEADER_ arguments, so that we can actually deprecate in a future version

* Use module.deprecate

* No need to de-dupe ourselves, looks like it is done somewhere I didn't initially see
pull/22149/head
Matt Martz 8 years ago committed by Brian Coca
parent 6ea4e9f17f
commit 6e8e90ceb4

@ -413,6 +413,9 @@ def main():
# currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}') # currently a bit ugly. (e.g. headers='{"Content-Type":"application/json"}')
for key, value in six.iteritems(module.params): for key, value in six.iteritems(module.params):
if key.startswith("HEADER_"): if key.startswith("HEADER_"):
module.deprecate('Supplying headers via HEADER_* is deprecated and '
'will be removed in a future version. Please use '
'`headers` to supply headers for the request')
skey = key.replace("HEADER_", "") skey = key.replace("HEADER_", "")
dict_headers[skey] = value dict_headers[skey] = value

@ -180,7 +180,8 @@
url: 'http://{{ httpbin_host }}/digest-auth/auth/user/passwd' url: 'http://{{ httpbin_host }}/digest-auth/auth/user/passwd'
user: user user: user
password: passwd password: passwd
HEADER_Cookie: "fake=fake_value" headers:
Cookie: "fake=fake_value"
- name: test PUT - name: test PUT
uri: uri:

Loading…
Cancel
Save