Skip to content

Commit

Permalink
prevent empty data payload from being send to host
Browse files Browse the repository at this point in the history
This commit addresses an issue where an empty data payload would be send
to the host as an empty array or empty object.  This change will now
check if the data is empty and not attempting to send it to the host if
it is.
  • Loading branch information
privateip committed Nov 12, 2024
1 parent 6dabeb4 commit 8ba0350
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: itential
name: core

# The version of the collection. Must be compatible with semantic versioning
version: 1.0.1
version: 1.0.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def send_request(method, url, headers=None, data=None, params=None, auth=None, t
"method": method,
"url": url,
"headers": headers,
"data": data,
"params": params,
"verify": verify,
}
Expand All @@ -74,7 +73,7 @@ def send_request(method, url, headers=None, data=None, params=None, auth=None, t
if certificate_file is not None and private_key_file is not None:
kwargs["cert"] = (certificate_file, private_key_file)

if isinstance(kwargs.get("data"), (dict, list)):
if isinstance(kwargs.get("data"), (dict, list)) and kwargs.get("data"):
kwargs["data"] = json.dumps(data)

display.vvvvv(f"Request object: {kwargs}")
Expand Down

0 comments on commit 8ba0350

Please sign in to comment.