mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-11 00:18:46 +01:00
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:
commit
f602306069
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user