From f8e43b8b0fd1d6195e8efb8356e26b80d6dea9c3 Mon Sep 17 00:00:00 2001 From: Kevin Caffrey Date: Fri, 29 Jan 2021 14:52:29 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"=F0=9F=90=9B[RUMF-809]=20URL=20encode?= =?UTF-8?q?=20tags=20in=20intake=20requests=20(#689)"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8b051eae776a5c4baf4e8a92044ab161fc3d7c6b. --- .../core/src/domain/configuration.spec.ts | 25 +++++++------------ packages/core/src/domain/configuration.ts | 4 +-- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/core/src/domain/configuration.spec.ts b/packages/core/src/domain/configuration.spec.ts index 8e4063aa01..be1fe9e864 100644 --- a/packages/core/src/domain/configuration.spec.ts +++ b/packages/core/src/domain/configuration.spec.ts @@ -62,34 +62,27 @@ describe('configuration', () => { describe('sdk_version, env, version and service', () => { it('should not modify the logs and rum endpoints tags when not defined', () => { const configuration = buildConfiguration({ clientToken }, usEnv) - expect(decodeURIComponent(configuration.rumEndpoint)).toContain(`&ddtags=sdk_version:${usEnv.sdkVersion}`) + expect(configuration.rumEndpoint).toContain(`&ddtags=sdk_version:${usEnv.sdkVersion}`) - expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',env:') - expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',service:') - expect(decodeURIComponent(configuration.rumEndpoint)).not.toContain(',version:') - expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',env:') - expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',service:') - expect(decodeURIComponent(configuration.logsEndpoint)).not.toContain(',version:') + expect(configuration.rumEndpoint).not.toContain(',env:') + expect(configuration.rumEndpoint).not.toContain(',service:') + expect(configuration.rumEndpoint).not.toContain(',version:') + expect(configuration.logsEndpoint).not.toContain(',env:') + expect(configuration.logsEndpoint).not.toContain(',service:') + expect(configuration.logsEndpoint).not.toContain(',version:') }) it('should be set as tags in the logs and rum endpoints', () => { const configuration = buildConfiguration({ clientToken, env: 'foo', service: 'bar', version: 'baz' }, usEnv) - expect(decodeURIComponent(configuration.rumEndpoint)).toContain( + expect(configuration.rumEndpoint).toContain( `&ddtags=sdk_version:${usEnv.sdkVersion},env:foo,service:bar,version:baz` ) - expect(decodeURIComponent(configuration.logsEndpoint)).toContain( + expect(configuration.logsEndpoint).toContain( `&ddtags=sdk_version:${usEnv.sdkVersion},env:foo,service:bar,version:baz` ) }) }) - describe('tags', () => { - it('should be encoded', () => { - const configuration = buildConfiguration({ clientToken, service: 'bar+foo' }, usEnv) - expect(configuration.rumEndpoint).toContain(`ddtags=sdk_version%3Asome_version%2Cservice%3Abar%2Bfoo`) - }) - }) - describe('cookie options', () => { it('should not be secure nor crossSite by default', () => { const configuration = buildConfiguration({ clientToken }, usEnv) diff --git a/packages/core/src/domain/configuration.ts b/packages/core/src/domain/configuration.ts index de44086719..a95a4071f2 100644 --- a/packages/core/src/domain/configuration.ts +++ b/packages/core/src/domain/configuration.ts @@ -246,9 +246,7 @@ function getEndpoint( const host = conf.proxyHost ? conf.proxyHost : datadogHost const proxyParameter = conf.proxyHost ? `ddhost=${datadogHost}&` : '' const applicationIdParameter = conf.applicationId ? `_dd.application_id=${conf.applicationId}&` : '' - const parameters = `${applicationIdParameter}${proxyParameter}ddsource=${ - source || 'browser' - }&ddtags=${encodeURIComponent(tags)}` + const parameters = `${applicationIdParameter}${proxyParameter}ddsource=${source || 'browser'}&ddtags=${tags}` return `https://${host}/v1/input/${conf.clientToken}?${parameters}` }