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

binding.py // Context.request URL-encodes request body #577

Open
moschi opened this issue May 27, 2024 · 1 comment
Open

binding.py // Context.request URL-encodes request body #577

moschi opened this issue May 27, 2024 · 1 comment

Comments

@moschi
Copy link

moschi commented May 27, 2024

Bug description
We have a REST endpoint to update a datastructure that requires the use of the HTTP PUT method.
We're using request from the Context class to send a request to that endpoint.
On binding.py#L876, the _encode method is called, whose result is used to overwrite the original body parameter of the method. This causes the request-body to be url-encoded and url-formatted.

Steps to reproduce the behavior:

Send a HTTP PUT request with a JSON body to an endpoint, using the request method of the Context class.

Expected behavior

The request method correctly escapes a JSON body, or provides instructions on how to call it to prevent the URL-encoding.

Logs or Screenshots

Currently, our REST endpoint receives a payload similar to this:

event=%7B%27_key%27%3A+%2766548f65179fc9792600b193%27%2C+%27tenant_uid%27%3A+%27default%27%7D&update_objects=%7B%27attribute%27%3A+status%2C+%27value%27%3A+%2766436bc36265a3697e049fe6%27%7D&comment=Updated

which does not decode to a valid JSON structure:

event={'_key':+'66548f65179fc9792600b193',+'tenant_uid':+'default'}&update_objects={'attribute':+status,+'value':+'66436bc36265a3697e049fe6'}&comment=Updated

Splunk:

  • Version: Enterprise 9.1.1
  • OS: RHEL 8.8 (Ootpa)
  • Deployment: single-instance

SDK:

  • Version: 1.7.4, bug persists in 2.0.1
  • Language Runtime Version: python 3.7
  • OS: RHEL 8.8 (Ootpa)
@seiimonn
Copy link

Hi team!

Could we please get a response on this?
It seems to be a minor fix!

Thank you!

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

No branches or pull requests

2 participants