mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
🐛 Fixed url params serializing for OAuth1 requests (#2381)
This commit is contained in:
parent
c97ceba86d
commit
e39678b54f
|
@ -86,6 +86,12 @@ import {
|
|||
axios.defaults.timeout = 300000;
|
||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||
axios.defaults.headers.post = {};
|
||||
axios.defaults.paramsSerializer = (params) => {
|
||||
if (params instanceof URLSearchParams) {
|
||||
return params.toString();
|
||||
}
|
||||
return stringify(params, { arrayFormat: 'indices' });
|
||||
};
|
||||
|
||||
const requestPromiseWithDefaults = requestPromise.defaults({
|
||||
timeout: 300000, // 5 minutes
|
||||
|
@ -413,6 +419,7 @@ async function parseRequestObject(requestObject: IDataObject) {
|
|||
if (
|
||||
requestObject.json !== false &&
|
||||
axiosConfig.data !== undefined &&
|
||||
axiosConfig.data !== '' &&
|
||||
!(axiosConfig.data instanceof Buffer) &&
|
||||
!allHeaders.some((headerKey) => headerKey.toLowerCase() === 'content-type')
|
||||
) {
|
||||
|
@ -462,6 +469,11 @@ async function proxyRequestToAxios(
|
|||
|
||||
axiosConfig = Object.assign(axiosConfig, await parseRequestObject(configObject));
|
||||
|
||||
Logger.debug('Proxying request to axios', {
|
||||
originalConfig: configObject,
|
||||
parsedConfig: axiosConfig,
|
||||
});
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
axios(axiosConfig)
|
||||
.then((response) => {
|
||||
|
|
Loading…
Reference in a new issue