mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-27 23:40:28 +05:30
#337: properly serialize null values in request.buildQuery
This commit is contained in:
parent
59000926ab
commit
41661dbea5
@ -114,7 +114,7 @@ function doFetch(url, options = {}) {
|
||||
* @return {string}
|
||||
*/
|
||||
function convertQueryValue(value) {
|
||||
if (typeof value === 'undefined') {
|
||||
if (typeof value === 'undefined' || value === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,13 @@ describe('services/request', () => {
|
||||
it('should build query', () => {
|
||||
const data = {
|
||||
notSet: undefined,
|
||||
notSet2: null,
|
||||
numeric: 1,
|
||||
complexString: 'sdfgs sdfg ',
|
||||
positive: true,
|
||||
negative: false
|
||||
};
|
||||
const expectedQs = 'notSet=&numeric=1&complexString=sdfgs%20sdfg%20&positive=1&negative=0';
|
||||
const expectedQs = 'notSet=¬Set2=&numeric=1&complexString=sdfgs%20sdfg%20&positive=1&negative=0';
|
||||
|
||||
expect(request.buildQuery(data), 'to equal', expectedQs);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user