| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5b44107 commit f2f768f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -307,6 +307,7 @@ assert.strictEqual(qs.stringify({ foo: -0 }), 'foo=0'); | |||
| 307 | 307 | assert.strictEqual(qs.stringify({ foo: 3 }), 'foo=3'); | |
| 308 | 308 | assert.strictEqual(qs.stringify({ foo: -72.42 }), 'foo=-72.42'); | |
| 309 | 309 | assert.strictEqual(qs.stringify({ foo: NaN }), 'foo='); | |
| 310 | + assert.strictEqual(qs.stringify({ foo: 1e21 }), 'foo=1e%2B21'); | ||
| 310 | 311 | assert.strictEqual(qs.stringify({ foo: Infinity }), 'foo='); | |
| 311 | 312 | ||
| 312 | 313 | // nested | |
@@ -450,6 +451,14 @@ check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' }); | |||
| 450 | 451 | 'a=a&b=b&c=c'); | |
| 451 | 452 | } | |
| 452 | 453 | ||
| 454 | + // Test custom encode for different types | ||
| 455 | + { | ||
| 456 | + const obj = { number: 1, bigint: 2n, true: true, false: false, object: {} }; | ||
| 457 | + assert.strictEqual( | ||
| 458 | + qs.stringify(obj, null, null, { encodeURIComponent: (v) => v }), | ||
| 459 | + 'number=1&bigint=2&true=true&false=false&object='); | ||
| 460 | + } | ||
| 461 | + | ||
| 453 | 462 | // Test QueryString.unescapeBuffer | |
| 454 | 463 | qsUnescapeTestCases.forEach((testCase) => { | |
| 455 | 464 | assert.strictEqual(qs.unescape(testCase[0]), testCase[1]); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments