diff --git a/.gitignore b/.gitignore index b7868a9e41..cf1f74e41c 100644 --- a/.gitignore +++ b/.gitignore @@ -512,3 +512,7 @@ $RECYCLE.BIN/ # Integration tests cloud configs tests/integration/cloud-config-*.ini + + +# VSCode specific extensions +.vscode/settings.json diff --git a/changelogs/fragments/7683-added-contenttype-parameter.yml b/changelogs/fragments/7683-added-contenttype-parameter.yml new file mode 100644 index 0000000000..52f4b6b0c5 --- /dev/null +++ b/changelogs/fragments/7683-added-contenttype-parameter.yml @@ -0,0 +1,2 @@ +minor_changes: + - rundeck module utils - allow to pass ``Content-Type`` to API requests (https://github.com/ansible-collections/community.general/pull/7684). \ No newline at end of file diff --git a/plugins/module_utils/rundeck.py b/plugins/module_utils/rundeck.py index 7df68a3603..cffca7b4ee 100644 --- a/plugins/module_utils/rundeck.py +++ b/plugins/module_utils/rundeck.py @@ -28,7 +28,7 @@ def api_argument_spec(): return api_argument_spec -def api_request(module, endpoint, data=None, method="GET"): +def api_request(module, endpoint, data=None, method="GET", content_type="application/json"): """Manages Rundeck API requests via HTTP(S) :arg module: The AnsibleModule (used to get url, api_version, api_token, etc). @@ -63,7 +63,7 @@ def api_request(module, endpoint, data=None, method="GET"): data=json.dumps(data), method=method, headers={ - "Content-Type": "application/json", + "Content-Type": content_type, "Accept": "application/json", "X-Rundeck-Auth-Token": module.params["api_token"] }