mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-24 17:03:47 +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) {
|
||||
const item = findItemInCollection(collection, action.payload.itemUid);
|
||||
|
||||
|
||||
if(item && isItemARequest(item)) {
|
||||
if(!item.draft) {
|
||||
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
|
||||
// we however are also storing the full url (with params) in the url itself
|
||||
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) => {
|
||||
each(sourceItems, (si) => {
|
||||
const di = {
|
||||
@ -116,6 +128,7 @@ export const transformCollectionToSaveToIdb = (collection, options = {}) => {
|
||||
url: si.draft.request.url,
|
||||
method: si.draft.request.method,
|
||||
headers: copyHeaders(si.draft.request.headers),
|
||||
params: copyQueryParams(si.draft.request.params),
|
||||
body: {
|
||||
mode: si.draft.request.body.mode,
|
||||
content: replaceTabsWithSpaces(si.draft.request.body.content)
|
||||
@ -128,6 +141,7 @@ export const transformCollectionToSaveToIdb = (collection, options = {}) => {
|
||||
url: si.request.url,
|
||||
method: si.request.method,
|
||||
headers: copyHeaders(si.request.headers),
|
||||
params: copyQueryParams(si.request.params),
|
||||
body: {
|
||||
mode: si.request.body.mode,
|
||||
content: replaceTabsWithSpaces(si.request.body.content)
|
||||
|
Loading…
Reference in New Issue
Block a user