mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34: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;
|
axios.defaults.timeout = 300000;
|
||||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||||
axios.defaults.headers.post = {};
|
axios.defaults.headers.post = {};
|
||||||
|
axios.defaults.paramsSerializer = (params) => {
|
||||||
|
if (params instanceof URLSearchParams) {
|
||||||
|
return params.toString();
|
||||||
|
}
|
||||||
|
return stringify(params, { arrayFormat: 'indices' });
|
||||||
|
};
|
||||||
|
|
||||||
const requestPromiseWithDefaults = requestPromise.defaults({
|
const requestPromiseWithDefaults = requestPromise.defaults({
|
||||||
timeout: 300000, // 5 minutes
|
timeout: 300000, // 5 minutes
|
||||||
|
@ -413,6 +419,7 @@ async function parseRequestObject(requestObject: IDataObject) {
|
||||||
if (
|
if (
|
||||||
requestObject.json !== false &&
|
requestObject.json !== false &&
|
||||||
axiosConfig.data !== undefined &&
|
axiosConfig.data !== undefined &&
|
||||||
|
axiosConfig.data !== '' &&
|
||||||
!(axiosConfig.data instanceof Buffer) &&
|
!(axiosConfig.data instanceof Buffer) &&
|
||||||
!allHeaders.some((headerKey) => headerKey.toLowerCase() === 'content-type')
|
!allHeaders.some((headerKey) => headerKey.toLowerCase() === 'content-type')
|
||||||
) {
|
) {
|
||||||
|
@ -462,6 +469,11 @@ async function proxyRequestToAxios(
|
||||||
|
|
||||||
axiosConfig = Object.assign(axiosConfig, await parseRequestObject(configObject));
|
axiosConfig = Object.assign(axiosConfig, await parseRequestObject(configObject));
|
||||||
|
|
||||||
|
Logger.debug('Proxying request to axios', {
|
||||||
|
originalConfig: configObject,
|
||||||
|
parsedConfig: axiosConfig,
|
||||||
|
});
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios(axiosConfig)
|
axios(axiosConfig)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
Loading…
Reference in a new issue