Skip to content

feat(core): Deprecate urlEncode #14406

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

Merged
merged 3 commits into from
Nov 22, 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 packages/core/src/utils-hoist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export {
getOriginalFunction,
markFunctionWrapped,
objectify,
// eslint-disable-next-line deprecation/deprecation
urlEncode,
} from './object';
export { basename, dirname, isAbsolute, join, normalizePath, relative, resolve } from './path';
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/utils-hoist/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export function getOriginalFunction(func: WrappedFunction): WrappedFunction | un
*
* @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.
*/
export function urlEncode(object: { [key: string]: any }): string {
return Object.keys(object)
Expand Down
3 changes: 3 additions & 0 deletions packages/core/test/utils-hoist/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,17 @@ 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');
});
});
Expand Down
Loading