diff --git a/lib/api/buildUrl.test.ts b/lib/api/buildUrl.test.ts index 49ea67003d..29ea283a95 100644 --- a/lib/api/buildUrl.test.ts +++ b/lib/api/buildUrl.test.ts @@ -34,7 +34,7 @@ describe('falsy query parameters', () => { test('builds URL with array-like query parameters', () => { const url = buildUrl('block', { height_or_hash: '42' }, { includeTx: [ '0x11', '0x22' ], sort: 'asc' }); - expect(url).toBe('https://localhost:3003/api/v2/blocks/42?includeTx%5B0%5D=0x11&includeTx%5B1%5D=0x22&sort=asc'); + expect(url).toBe('https://localhost:3003/api/v2/blocks/42?includeTx=0x11%2C0x22&sort=asc'); }); test('builds URL for resource with custom API endpoint', () => { diff --git a/lib/api/buildUrl.ts b/lib/api/buildUrl.ts index 35189fa08f..07805dbd9c 100644 --- a/lib/api/buildUrl.ts +++ b/lib/api/buildUrl.ts @@ -19,13 +19,7 @@ export default function buildUrl( queryParams && Object.entries(queryParams).forEach(([ key, value ]) => { // there are some pagination params that can be null or false for the next page - if (value !== undefined && value !== '') { - if (Array.isArray(value)) { - value.forEach((v, i) => url.searchParams.append(`${ key }[${ i }]`, String(v))); - } else { - url.searchParams.append(key, String(value)); - } - } + value !== undefined && value !== '' && url.searchParams.append(key, String(value)); }); return url.toString(); diff --git a/ui/address/AddressTokenTransfers.pw.tsx b/ui/address/AddressTokenTransfers.pw.tsx index e64bb33620..3befb96359 100644 --- a/ui/address/AddressTokenTransfers.pw.tsx +++ b/ui/address/AddressTokenTransfers.pw.tsx @@ -108,7 +108,7 @@ test.describe('socket', () => { }, }; - const API_URL_NO_TOKEN = buildApiUrl('address_token_transfers', { hash: CURRENT_ADDRESS }); + const API_URL_NO_TOKEN = buildApiUrl('address_token_transfers', { hash: CURRENT_ADDRESS }) + '?type='; await page.route(API_URL_NO_TOKEN, (route) => route.fulfill({ status: 200, @@ -144,7 +144,7 @@ test.describe('socket', () => { }, }; - const API_URL_NO_TOKEN = buildApiUrl('address_token_transfers', { hash: CURRENT_ADDRESS }); + const API_URL_NO_TOKEN = buildApiUrl('address_token_transfers', { hash: CURRENT_ADDRESS }) + '?type='; await page.route(API_URL_NO_TOKEN, (route) => route.fulfill({ status: 200, diff --git a/ui/address/AddressTokens.pw.tsx b/ui/address/AddressTokens.pw.tsx index 49494a35b9..7ee5556986 100644 --- a/ui/address/AddressTokens.pw.tsx +++ b/ui/address/AddressTokens.pw.tsx @@ -13,8 +13,8 @@ import AddressTokens from './AddressTokens'; const ADDRESS_HASH = addressMock.withName.hash; const API_URL_ADDRESS = buildApiUrl('address', { hash: ADDRESS_HASH }); const API_URL_TOKENS = buildApiUrl('address_tokens', { hash: ADDRESS_HASH }); -const API_URL_NFT = buildApiUrl('address_nfts', { hash: ADDRESS_HASH }); -const API_URL_COLLECTIONS = buildApiUrl('address_collections', { hash: ADDRESS_HASH }); +const API_URL_NFT = buildApiUrl('address_nfts', { hash: ADDRESS_HASH }) + '?type='; +const API_URL_COLLECTIONS = buildApiUrl('address_collections', { hash: ADDRESS_HASH }) + '?type='; const nextPageParams = { items_count: 50, diff --git a/ui/pages/Tokens.pw.tsx b/ui/pages/Tokens.pw.tsx index 9225dbb654..ce714a2fee 100644 --- a/ui/pages/Tokens.pw.tsx +++ b/ui/pages/Tokens.pw.tsx @@ -111,7 +111,7 @@ base.describe('bridged tokens', async() => { }); test('base view', async({ mount, page }) => { - await page.route(BRIDGED_TOKENS_API_URL + '?chain_ids%5B0%5D=99', (route) => route.fulfill({ + await page.route(BRIDGED_TOKENS_API_URL + '?chain_ids=99', (route) => route.fulfill({ status: 200, body: JSON.stringify(bridgedFilteredTokens), }));