Add allowDots config option for qs stringify (#20687)

This commit is contained in:
Carlos Bonetti
2017-10-23 19:47:46 -02:00
committed by Sheetal Nandi
parent 403dbdabc7
commit b81ccf4769
2 changed files with 6 additions and 0 deletions

2
types/qs/index.d.ts vendored
View File

@@ -5,6 +5,7 @@
// Belinda Teh <https://github.com/tehbelinda>
// Melvin Lee <https://github.com/zyml>
// Arturs Vonda <https://github.com/artursvonda>
// Carlos Bonetti <https://github.com/CarlosBonetti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = QueryString;
@@ -25,6 +26,7 @@ declare namespace QueryString {
format?: 'RFC1738' | 'RFC3986';
encodeValuesOnly?: boolean;
addQueryPrefix?: boolean;
allowDots?: boolean;
}
interface IParseOptions {

View File

@@ -287,3 +287,7 @@ qs.parse('a=b&c=d', { delimiter: '&' });
() => {
assert.equal(qs.stringify({ a: 'b' }, { addQueryPrefix: true }), '?a=b');
}
() => {
assert.equal(qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }), 'a.b.c=d&a.b.e=f');
}