Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding helper functions for convenient PUT and PATCH on SDK #586

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

seiimonn
Copy link

@seiimonn seiimonn commented Oct 7, 2024

The current SDK does not provide dedicated functions for sending PUT and PATCH requests to endpoints in Splunk. These operations were only possible using the generic request method, which had issues correctly formatting a body payload, especially for form-encoded data.

This change introduces helper functions for PUT and POST requests, along with a new _prepare_request_body_and_url function to streamline body and URL preparation logic. This ensures consistency, reduces redundancy, and resolves issues with incorrect payload formatting when making these requests.

Changes

  • Added a _prepare_request_body_and_url helper function to handle body preparation and URL encoding for POST and PUT requests.
  • Added put() and updated post() methods to leverage the helper function.
  • Ensured proper handling of Content-Type headers for form-encoded data.

Benefits

  • Simplifies making PUT and PATCH requests directly without needing the generic request method.
  • Fixes body formatting issues, ensuring payloads are correctly encoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant