Merge pull request #515 from Its-treason/fix/parse-query-params-on-request-creation

fix(#500): Parse query url on request creation
This commit is contained in:
Anoop M D 2023-10-11 03:00:38 +05:30 committed by GitHub
commit f602306069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -45,6 +45,8 @@ import {
import { closeAllCollectionTabs } from 'providers/ReduxStore/slices/tabs';
import { resolveRequestFilename } from 'utils/common/platform';
import { parseQueryParams, splitOnFirst } from 'utils/url/index';
import { each } from 'lodash';
const PATH_SEPARATOR = path.sep;
@ -588,6 +590,12 @@ export const newHttpRequest = (params) => (dispatch, getState) => {
return reject(new Error('Collection not found'));
}
const parts = splitOnFirst(requestUrl, '?');
const params = parseQueryParams(parts[1]);
each(params, (urlParam) => {
urlParam.enabled = true;
});
const collectionCopy = cloneDeep(collection);
const item = {
uid: uuid(),
@ -597,6 +605,7 @@ export const newHttpRequest = (params) => (dispatch, getState) => {
method: requestMethod,
url: requestUrl,
headers: [],
params,
body: {
mode: 'none',
json: null,

View File

@ -286,6 +286,12 @@ export const collectionsSlice = createSlice({
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
if (collection && collection.items && collection.items.length) {
const parts = splitOnFirst(action.payload.requestUrl, '?');
const params = parseQueryParams(parts[1]);
each(params, (urlParam) => {
urlParam.enabled = true;
});
const item = {
uid: action.payload.uid,
name: action.payload.requestName,
@ -293,7 +299,7 @@ export const collectionsSlice = createSlice({
request: {
url: action.payload.requestUrl,
method: action.payload.requestMethod,
params: [],
params,
headers: [],
body: {
mode: null,