[typescript-fetch] Double ampersand in query string with empty nested object (#2679)

* [typescript-fetch] Filter empty parts from querystring before joining with '&'

* [typescript-fetch] Update samples
This commit is contained in:
Lukas S 2019-04-18 05:04:35 +02:00 committed by William Cheng
parent 6a11a107d1
commit e17890d526
5 changed files with 5 additions and 0 deletions

View File

@ -198,6 +198,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
})
.filter(part => part.length > 0)
.join('&');
}

View File

@ -209,6 +209,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
})
.filter(part => part.length > 0)
.join('&');
}

View File

@ -209,6 +209,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
})
.filter(part => part.length > 0)
.join('&');
}

View File

@ -209,6 +209,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
})
.filter(part => part.length > 0)
.join('&');
}

View File

@ -209,6 +209,7 @@ export function querystring(params: HTTPQuery, prefix: string = ''): string {
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
})
.filter(part => part.length > 0)
.join('&');
}