From 3da5d74b9e624efa46118f5121c0a92ea72f8279 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Wed, 29 Jun 2022 17:46:41 -0400 Subject: [PATCH] Revert "Ensures there is no slash in url before query params" --- packages/toolkit/src/query/tests/utils.test.ts | 6 ------ packages/toolkit/src/query/utils/joinUrls.ts | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/toolkit/src/query/tests/utils.test.ts b/packages/toolkit/src/query/tests/utils.test.ts index 9500fa16f1..4b111b2a00 100644 --- a/packages/toolkit/src/query/tests/utils.test.ts +++ b/packages/toolkit/src/query/tests/utils.test.ts @@ -83,8 +83,6 @@ describe('joinUrls', () => { expect(joinUrls('', '/banana')).toBe('/banana') expect(joinUrls('', 'banana')).toBe('banana') - - expect(joinUrls('/api', '?foo=bar')).toBe('/api?foo=bar') }) test('correctly joins variations of absolute urls', () => { @@ -101,10 +99,6 @@ describe('joinUrls', () => { expect(joinUrls('https://example.com/api/', '/banana/')).toBe( 'https://example.com/api/banana/' ) - - expect(joinUrls('https://example.com/api/', '?foo=bar')).toBe( - 'https://example.com/api?foo=bar' - ) }) }) diff --git a/packages/toolkit/src/query/utils/joinUrls.ts b/packages/toolkit/src/query/utils/joinUrls.ts index b978dcf4db..f675338611 100644 --- a/packages/toolkit/src/query/utils/joinUrls.ts +++ b/packages/toolkit/src/query/utils/joinUrls.ts @@ -20,7 +20,6 @@ export function joinUrls( base = withoutTrailingSlash(base) url = withoutLeadingSlash(url) - const delimiter = url.startsWith('?') ? '' : '/' - return `${base}${delimiter}${url}`; + return `${base}/${url}` }