-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes a bug where SDK fails to serialize JavaScript Objects if they contain key 'length' with number value. The reason for this bug seems to be in lodash `_.reduce` function. See lodash/lodash#5870 The solution is to use Object.entries + reduce instead of lodash reduce.
- Loading branch information
Showing
5 changed files
with
57 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import { fnPath, trimEndSlash, formData, objectQueryString, canonicalAssetPaths } from './utils'; | ||
import { | ||
fnPath, | ||
trimEndSlash, | ||
formData, | ||
objectQueryString, | ||
canonicalAssetPaths, | ||
} from './utils'; | ||
|
||
describe('utils', () => { | ||
describe('pathToMethodName', () => { | ||
|
@@ -33,6 +39,11 @@ describe('utils', () => { | |
formData({ username: '[email protected]', password: '}4$3.872487=3&&]/6?.' }) | ||
).toEqual('username=joe.dunphy%40example.com&password=%7D4%243.872487%3D3%26%26%5D%2F6%3F.'); | ||
}); | ||
|
||
it('encodes Object with key length', () => { | ||
// See: https://github.com/lodash/lodash/issues/5870 | ||
expect(formData({ length: 10 })).toEqual('length=10'); | ||
}); | ||
}); | ||
|
||
describe('objectQueryString', () => { | ||
|