refactor: now the key params in the axiosRequest creation phase is pathParams to resolve the naming conflicts of axios. (#2465)

This commit is contained in:
Sanjai Kumar 2024-06-18 16:37:08 +05:30 committed by GitHub
parent 271f988d99
commit 9588b442f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -255,6 +255,10 @@ const configureRequest = async (
request.headers['cookie'] = cookieString;
}
}
// Remove pathParams, already in URL (Issue #2439)
delete request.pathParams;
return axiosInstance;
};

View File

@ -82,11 +82,11 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
request.data = _interpolate(request.data);
}
each(request.params, (param) => {
each(request.pathParams, (param) => {
param.value = _interpolate(param.value);
});
if (request?.params?.length) {
if (request?.pathParams?.length) {
let url = request.url;
if (!url.startsWith('http://') && !url.startsWith('https://')) {
@ -107,7 +107,7 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
return '/' + path;
} else {
const name = path.slice(1);
const existingPathParam = request.params.find((param) => param.type === 'path' && param.name === name);
const existingPathParam = request.pathParams.find((param) => param.type === 'path' && param.name === name);
return existingPathParam ? '/' + existingPathParam.value : '';
}
})

View File

@ -162,7 +162,7 @@ const prepareRequest = (request, collectionRoot, collectionPath) => {
method: request.method,
url,
headers,
params: request.params.filter((param) => param.type === 'path'),
pathParams: request.params.filter((param) => param.type === 'path'),
responseType: 'arraybuffer'
};