mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 01:14:23 +01:00
feat: save query params in request, resolves #5
This commit is contained in:
parent
2313afdb82
commit
8d4c56dbd9
@ -170,7 +170,7 @@ export const collectionsSlice = createSlice({
|
|||||||
|
|
||||||
if(collection) {
|
if(collection) {
|
||||||
const item = findItemInCollection(collection, action.payload.itemUid);
|
const item = findItemInCollection(collection, action.payload.itemUid);
|
||||||
|
|
||||||
if(item && isItemARequest(item)) {
|
if(item && isItemARequest(item)) {
|
||||||
if(!item.draft) {
|
if(!item.draft) {
|
||||||
item.draft = cloneDeep(item);
|
item.draft = cloneDeep(item);
|
||||||
@ -194,7 +194,7 @@ export const collectionsSlice = createSlice({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// ultimately params get replaced with params in url + the disabled onces that existed prior
|
// ultimately params get replaced with params in url + the disabled ones that existed prior
|
||||||
// the query params are the source of truth, the url in the queryurl input gets constructed using these params
|
// the query params are the source of truth, the url in the queryurl input gets constructed using these params
|
||||||
// we however are also storing the full url (with params) in the url itself
|
// we however are also storing the full url (with params) in the url itself
|
||||||
item.draft.request.params = concat(urlParams, disabledParams);
|
item.draft.request.params = concat(urlParams, disabledParams);
|
||||||
|
@ -100,6 +100,18 @@ export const transformCollectionToSaveToIdb = (collection, options = {}) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyQueryParams = (params) => {
|
||||||
|
return map(params, (param) => {
|
||||||
|
return {
|
||||||
|
uid: param.uid,
|
||||||
|
name: param.name,
|
||||||
|
value: param.value,
|
||||||
|
description: param.description,
|
||||||
|
enabled: param.enabled
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const copyItems = (sourceItems, destItems) => {
|
const copyItems = (sourceItems, destItems) => {
|
||||||
each(sourceItems, (si) => {
|
each(sourceItems, (si) => {
|
||||||
const di = {
|
const di = {
|
||||||
@ -116,6 +128,7 @@ export const transformCollectionToSaveToIdb = (collection, options = {}) => {
|
|||||||
url: si.draft.request.url,
|
url: si.draft.request.url,
|
||||||
method: si.draft.request.method,
|
method: si.draft.request.method,
|
||||||
headers: copyHeaders(si.draft.request.headers),
|
headers: copyHeaders(si.draft.request.headers),
|
||||||
|
params: copyQueryParams(si.draft.request.params),
|
||||||
body: {
|
body: {
|
||||||
mode: si.draft.request.body.mode,
|
mode: si.draft.request.body.mode,
|
||||||
content: replaceTabsWithSpaces(si.draft.request.body.content)
|
content: replaceTabsWithSpaces(si.draft.request.body.content)
|
||||||
@ -128,6 +141,7 @@ export const transformCollectionToSaveToIdb = (collection, options = {}) => {
|
|||||||
url: si.request.url,
|
url: si.request.url,
|
||||||
method: si.request.method,
|
method: si.request.method,
|
||||||
headers: copyHeaders(si.request.headers),
|
headers: copyHeaders(si.request.headers),
|
||||||
|
params: copyQueryParams(si.request.params),
|
||||||
body: {
|
body: {
|
||||||
mode: si.request.body.mode,
|
mode: si.request.body.mode,
|
||||||
content: replaceTabsWithSpaces(si.request.body.content)
|
content: replaceTabsWithSpaces(si.request.body.content)
|
||||||
|
Loading…
Reference in New Issue
Block a user