Bug Description
When using a Custom Auth credential in n8n with the Content-Type header set to application/x-www-form-urlencoded, the request body is still sent as JSON. This causes compatibility issues with APIs that strictly require form-encoded bodies for authentication or token refresh.
To Reproduce
- Create a Custom Auth credential with the following JSON:
{
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"body": {
"grant_type": "refresh_token",
"client_id": "my-client-id",
"client_secret": "my-client-secret",
"refresh_token": "my-refresh-token"
}
}
- Use this credential in an HTTP Request node with:
- Observe that the request fails with a 400 error and a message indicating that required parameters (e.g., client_id) were not supplied.
Expected behavior
The body should be sent as application/x-www-form-urlencoded when the header is explicitly set and the body is defined as key-value pairs.
Debug Info
The body is sent as JSON, which causes the API to reject the request.
Operating System
alpine-minirootfs-3.22.1-x86_64
n8n Version
1.110.0
Node.js Version
22.19
Database
SQLite
Execution mode
main (default)
Hosting
self hosted
Bug Description
When using a Custom Auth credential in n8n with the Content-Type header set to application/x-www-form-urlencoded, the request body is still sent as JSON. This causes compatibility issues with APIs that strictly require form-encoded bodies for authentication or token refresh.
To Reproduce
Expected behavior
The body should be sent as application/x-www-form-urlencoded when the header is explicitly set and the body is defined as key-value pairs.
Debug Info
The body is sent as JSON, which causes the API to reject the request.
Operating System
alpine-minirootfs-3.22.1-x86_64
n8n Version
1.110.0
Node.js Version
22.19
Database
SQLite
Execution mode
main (default)
Hosting
self hosted