mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Added parameter to select Content-Type when accessing the Rundeck API (#7684)
* Added parameter to select Content-Type when accessing the Rundeck API * Removed autogenerated file * Fixed missing yml extension * Updated changelog text better describe what has happened Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Nils Brinkmann <nils.brinkmann@rheinmetall.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7aa118b957
commit
4f4075a542
3 changed files with 8 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -512,3 +512,7 @@ $RECYCLE.BIN/
|
|||
|
||||
# Integration tests cloud configs
|
||||
tests/integration/cloud-config-*.ini
|
||||
|
||||
|
||||
# VSCode specific extensions
|
||||
.vscode/settings.json
|
||||
|
|
|
@ -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).
|
|
@ -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"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue