-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Bug Description
When sending a proxy request with Content-Type: application/x-www-form-urlencoded, Hyperswitch always serializes the request_body as JSON before forwarding it to the destination connector. This causes downstream APIs expecting form-encoded payloads to fail.
This was observed while integrating with Athena’s collectpayment endpoint, which strictly requires form-url-encoded body format.
Expected Behavior
Hyperswitch proxy service should detect the header Content-Type: application/x-www-form-urlencoded and forward the request_body encoded as form-url-encoded, not JSON.
Example expected format:
billingzip=85000&expirationyearyyyy=2030&departmentid=1&...
Actual Behavior
Even when the incoming proxy request contains "Content-Type": "application/x-www-form-urlencoded" the body is still sent as JSON
{
"billingzip": "85000",
"expirationyearyyyy": "2030",
"departmentid": "1"
}
Steps To Reproduce
Create a proxy request with the following payload:
{
"destination_url": "https://api.preview.platform.example.com/v1/1/user/1/collectpayment",
"headers": {
"Authorization": "Bearer <token>",
"Content-Type": "application/x-www-form-urlencoded"
},
"method": "POST",
"request_body": {
"billingzip": "85000",
"expirationyearyyyy": "2030",
"amount": "20.00"
}
}
Observe that the outgoing HTTP request body is JSON instead of form-encoded
Context For The Bug
No response
Environment
Are you using hyperswitch hosted version? No
If yes, please provide the value of the x-request-id response header to help us debug your issue.
If not (or if building/running locally), please provide the following details:
- Operating System or Linux distribution:
- Rust version (output of
rustc --version): `` - App version (output of
cargo r --features vergen -- --version): v1.117.0 withVERSION_FEATURE_SET v2
Have you spent some time checking if this bug has been raised before?
- I checked and didn't find a similar issue
Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to submit a PR?
Yes, I am willing to submit a PR!