You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
querystring.stringify does not support BigInt #36080
@kennytm what will be the use case of sending such large numbers in bigint form, ideally one will prefer to use string for such cases instead of bigint. Also when the parsing is applied what should be the value of the key, should it be 12345678901234567 or 12345678901234567n as both are valid options. Can you elaborate on the feature request?
@yashLadha There is a server producing JSON containing numbers recently upgraded to include 64-bit IDs. (The server is not written in JS and they have a well-defined schema so there is no problem handling 64-bit integers in JSON or query). So we used json-bigint to parse the output. Later we used the url module to generate a GET request, which internally used the querystring module to serialize the query. So that 64-bit ID becomes blank as a bigint isn't a number/string/boolean.
Yes we know we can .toString() and that's indeed our current workaround, but that can be said the same for number and boolean.
querystring.parse won't produce numbers so I don't see why parsing is relevant. The serialization should never contain the "n", as non-JS environment needs to process the output of querystring.
Activity
lib: add support for bigint in querystring
yashLadha commentedon Nov 13, 2020
@kennytm what will be the use case of sending such large numbers in bigint form, ideally one will prefer to use string for such cases instead of bigint. Also when the parsing is applied what should be the value of the key, should it be
12345678901234567or12345678901234567nas both are valid options. Can you elaborate on the feature request?kennytm commentedon Nov 13, 2020
@yashLadha There is a server producing JSON containing numbers recently upgraded to include 64-bit IDs. (The server is not written in JS and they have a well-defined schema so there is no problem handling 64-bit integers in JSON or query). So we used
json-bigintto parse the output. Later we used theurlmodule to generate a GET request, which internally used thequerystringmodule to serialize the query. So that 64-bit ID becomes blank as abigintisn't anumber/string/boolean.Yes we know we can
.toString()and that's indeed our current workaround, but that can be said the same fornumberandboolean.querystring.parsewon't produce numbers so I don't see why parsing is relevant. The serialization should never contain the "n", as non-JS environment needs to process the output ofquerystring.lib: support BigInt in querystring.stringify
lib: support BigInt in querystring.stringify
lib: support BigInt in querystring.stringify