Skip to content

Commit

Permalink
add query param even when value is missing (#1370)
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshlilha authored Jan 29, 2024
1 parent 467e63d commit 0dd8154
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/bruno-app/src/utils/url/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ export const stringifyQueryParams = (params) => {

let queryString = [];
each(params, (p) => {
if (!isEmpty(trim(p.name)) && !isEmpty(trim(p.value))) {
queryString.push(`${p.name}=${p.value}`);
const hasEmptyName = isEmpty(trim(p.name));
const hasEmptyVal = isEmpty(trim(p.value));

// query param name must be present
if (!hasEmptyName) {
// if query param value is missing, push only <param-name>, else push <param-name: param-value>
queryString.push(hasEmptyVal ? p.name : `${p.name}=${p.value}`);
}
});

Expand Down

0 comments on commit 0dd8154

Please sign in to comment.