From cdc3cb3bdf1c7323de2b2f5c9207b12e4e14c5f0 Mon Sep 17 00:00:00 2001 From: Pooja Date: Wed, 4 Feb 2026 15:43:21 +0530 Subject: [PATCH] fix: preserve empty query param equal sign (#7031) --- packages/bruno-common/src/utils/url/index.spec.ts | 2 +- packages/bruno-common/src/utils/url/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bruno-common/src/utils/url/index.spec.ts b/packages/bruno-common/src/utils/url/index.spec.ts index 19f934ab1..c36c4d75d 100644 --- a/packages/bruno-common/src/utils/url/index.spec.ts +++ b/packages/bruno-common/src/utils/url/index.spec.ts @@ -46,7 +46,7 @@ describe('encodeUrl', () => { it('should handle query parameters with empty values', () => { const url = 'https://example.com/api?name=&age=25&active='; - const expected = 'https://example.com/api?name&age=25&active'; + const expected = 'https://example.com/api?name=&age=25&active='; expect(encodeUrl(url)).toBe(expected); }); diff --git a/packages/bruno-common/src/utils/url/index.ts b/packages/bruno-common/src/utils/url/index.ts index 18a34de3f..5adf13201 100644 --- a/packages/bruno-common/src/utils/url/index.ts +++ b/packages/bruno-common/src/utils/url/index.ts @@ -18,7 +18,7 @@ function buildQueryString(paramsArray: QueryParam[], { encode = false }: BuildQu const finalName = encode ? encodeURIComponent(name) : name; const finalValue = encode ? encodeURIComponent(value ?? '') : (value ?? ''); - return finalValue ? `${finalName}=${finalValue}` : finalName; + return `${finalName}=${finalValue}`; }) .join('&'); }