Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core)!: Remove urlEncode method #14783

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ It will be removed in a future major version.

- The `getNumberOfUrlSegments` method has been removed. There is no replacement.
- The `validSeverityLevels` export has been removed. There is no replacement.
- The `urlEncode` method has been removed. There is no replacement.

### `@sentry/nestjs`

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/utils-hoist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export {
getOriginalFunction,
markFunctionWrapped,
objectify,
// eslint-disable-next-line deprecation/deprecation
urlEncode,
} from './object';
export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path';
export { makePromiseBuffer } from './promisebuffer';
Expand Down
15 changes: 0 additions & 15 deletions packages/core/src/utils-hoist/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,6 @@ export function getOriginalFunction<T extends Function>(func: WrappedFunction<T>
return func.__sentry_original__;
}

/**
* Encodes given object into url-friendly format
*
* @param object An object that contains serializable values
* @returns string Encoded
*
* @deprecated This function is deprecated and will be removed in the next major version of the SDK.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function urlEncode(object: { [key: string]: any }): string {
return Object.entries(object)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join('&');
}

/**
* Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their
* non-enumerable properties attached.
Expand Down
18 changes: 0 additions & 18 deletions packages/core/test/utils-hoist/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
fill,
markFunctionWrapped,
objectify,
urlEncode,
} from '../../src/utils-hoist/object';
import { testOnlyIfNodeVersionAtLeast } from './testutils';

Expand Down Expand Up @@ -128,23 +127,6 @@ describe('fill()', () => {
});
});

describe('urlEncode()', () => {
test('returns empty string for empty object input', () => {
// eslint-disable-next-line deprecation/deprecation
expect(urlEncode({})).toEqual('');
});

test('returns single key/value pair joined with = sign', () => {
// eslint-disable-next-line deprecation/deprecation
expect(urlEncode({ foo: 'bar' })).toEqual('foo=bar');
});

test('returns multiple key/value pairs joined together with & sign', () => {
// eslint-disable-next-line deprecation/deprecation
expect(urlEncode({ foo: 'bar', pickle: 'rick', morty: '4 2' })).toEqual('foo=bar&pickle=rick&morty=4%202');
});
});

describe('extractExceptionKeysForMessage()', () => {
test('no keys', () => {
expect(extractExceptionKeysForMessage({}, 10)).toEqual('[object has no keys]');
Expand Down
5 changes: 0 additions & 5 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ import {
triggerHandlers as triggerHandlers_imported,
truncate as truncate_imported,
updateRateLimits as updateRateLimits_imported,
urlEncode as urlEncode_imported,
uuid4 as uuid4_imported,
vercelWaitUntil as vercelWaitUntil_imported,
watchdogTimer as watchdogTimer_imported,
Expand Down Expand Up @@ -615,10 +614,6 @@ export const arrayify = arrayify_imported;
/** @deprecated Import from `@sentry/core` instead. */
export const normalizeUrlToBase = normalizeUrlToBase_imported;

/** @deprecated Import from `@sentry/core` instead. */
// eslint-disable-next-line deprecation/deprecation
export const urlEncode = urlEncode_imported;

/** @deprecated Import from `@sentry/core` instead. */
// eslint-disable-next-line deprecation/deprecation
export const extractPathForTransaction = extractPathForTransaction_imported;
Expand Down
Loading