Skip to content

Commit b7730d8

Browse files
authored
feat(core)!: Remove urlEncode method (#14783)
ref: #14268 Deprecation PR: #14406 Removes `urlEncode`. This has no replacement.
1 parent 2628e40 commit b7730d8

File tree

5 files changed

+1
-40
lines changed

5 files changed

+1
-40
lines changed

docs/migration/v8-to-v9.md

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ It will be removed in a future major version.
108108
- The `validSeverityLevels` export has been removed. There is no replacement.
109109
- The `arrayify` export has been removed. There is no replacement.
110110
- The `flatten` export has been removed. There is no replacement.
111+
- The `urlEncode` method has been removed. There is no replacement.
111112

112113
### `@sentry/nestjs`
113114

packages/core/src/utils-hoist/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ export {
5757
getOriginalFunction,
5858
markFunctionWrapped,
5959
objectify,
60-
// eslint-disable-next-line deprecation/deprecation
61-
urlEncode,
6260
} from './object';
6361
export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path';
6462
export { makePromiseBuffer } from './promisebuffer';

packages/core/src/utils-hoist/object.ts

-15
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,6 @@ export function getOriginalFunction<T extends Function>(func: WrappedFunction<T>
8686
return func.__sentry_original__;
8787
}
8888

89-
/**
90-
* Encodes given object into url-friendly format
91-
*
92-
* @param object An object that contains serializable values
93-
* @returns string Encoded
94-
*
95-
* @deprecated This function is deprecated and will be removed in the next major version of the SDK.
96-
*/
97-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
98-
export function urlEncode(object: { [key: string]: any }): string {
99-
return Object.entries(object)
100-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
101-
.join('&');
102-
}
103-
10489
/**
10590
* Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their
10691
* non-enumerable properties attached.

packages/core/test/utils-hoist/object.test.ts

-18
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
fill,
1212
markFunctionWrapped,
1313
objectify,
14-
urlEncode,
1514
} from '../../src/utils-hoist/object';
1615
import { testOnlyIfNodeVersionAtLeast } from './testutils';
1716

@@ -128,23 +127,6 @@ describe('fill()', () => {
128127
});
129128
});
130129

131-
describe('urlEncode()', () => {
132-
test('returns empty string for empty object input', () => {
133-
// eslint-disable-next-line deprecation/deprecation
134-
expect(urlEncode({})).toEqual('');
135-
});
136-
137-
test('returns single key/value pair joined with = sign', () => {
138-
// eslint-disable-next-line deprecation/deprecation
139-
expect(urlEncode({ foo: 'bar' })).toEqual('foo=bar');
140-
});
141-
142-
test('returns multiple key/value pairs joined together with & sign', () => {
143-
// eslint-disable-next-line deprecation/deprecation
144-
expect(urlEncode({ foo: 'bar', pickle: 'rick', morty: '4 2' })).toEqual('foo=bar&pickle=rick&morty=4%202');
145-
});
146-
});
147-
148130
describe('extractExceptionKeysForMessage()', () => {
149131
test('no keys', () => {
150132
expect(extractExceptionKeysForMessage({}, 10)).toEqual('[object has no keys]');

packages/utils/src/index.ts

-5
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ import {
151151
triggerHandlers as triggerHandlers_imported,
152152
truncate as truncate_imported,
153153
updateRateLimits as updateRateLimits_imported,
154-
urlEncode as urlEncode_imported,
155154
uuid4 as uuid4_imported,
156155
vercelWaitUntil as vercelWaitUntil_imported,
157156
watchdogTimer as watchdogTimer_imported,
@@ -605,10 +604,6 @@ export const memoBuilder = memoBuilder_imported;
605604
/** @deprecated Import from `@sentry/core` instead. */
606605
export const normalizeUrlToBase = normalizeUrlToBase_imported;
607606

608-
/** @deprecated Import from `@sentry/core` instead. */
609-
// eslint-disable-next-line deprecation/deprecation
610-
export const urlEncode = urlEncode_imported;
611-
612607
/** @deprecated Import from `@sentry/core` instead. */
613608
// eslint-disable-next-line deprecation/deprecation
614609
export const extractPathForTransaction = extractPathForTransaction_imported;

0 commit comments

Comments
 (0)