-
Couldn't load subscription status.
- Fork 385
Description
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)