Skip to content

Commit e2134c3

Browse files
👌 make parameters optional
1 parent e1b928f commit e2134c3

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/core/src/domain/configuration/endpointBuilder.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,16 @@ describe('endpointBuilder', () => {
173173
).toBe('https://quota.proxy.test/api/v2/profiling/quota?session_id=abc')
174174
})
175175

176+
it('falls back to empty parameters when calling proxy function', () => {
177+
expect(
178+
buildEndpointUrl({
179+
proxy: ({ path, parameters }) => `https://proxy.test${path}?${parameters}`,
180+
site: undefined,
181+
path: '/api/v2/rum',
182+
})
183+
).toBe('https://proxy.test/api/v2/rum?')
184+
})
185+
176186
it('builds intake URL from the site when no proxy is configured', () => {
177187
expect(
178188
buildEndpointUrl({

packages/core/src/domain/configuration/endpointBuilder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ export interface BuildEndpointUrlOptions {
5858
site: Site | undefined
5959
subdomain?: string
6060
path: string
61-
parameters: string
61+
parameters?: string
6262
}
6363

6464
export function buildEndpointUrl({
6565
proxy,
6666
site = INTAKE_SITE_US1,
6767
path,
68-
parameters,
68+
parameters = '',
6969
subdomain,
7070
}: BuildEndpointUrlOptions): string {
7171
let pathAndParameters = path

packages/rum-core/src/domain/configuration/remoteConfiguration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ export function buildEndpoint(configuration: RumInitConfiguration) {
325325
site: configuration.site,
326326
path: `/${REMOTE_CONFIGURATION_VERSION}/${encodeURIComponent(id)}.json`,
327327
subdomain: 'sdk-configuration',
328-
parameters: '',
329328
})
330329
}
331330

0 commit comments

Comments
 (0)