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('&'); }