Wrapper for the qs and querystring modules.
See @request/core for more details.
By default @request/qs
uses the qs module:
var qs = require('@request/qs')
qs.parse(str)
qs.stringify(obj)
var qs = require('@request/qs')
var options = {
// parse options
parse: {
qs: {sep: ';', eq: ':'}
},
// stringify options
stringify: {
qs: {sep: ';', eq: ':'}
}
}
qs.parse(str, options)
qs.stringify(obj, options)
To use the querystring module instead, set the parse
and stringify
option keys to querystring
:
var qs = require('@request/qs')
var options = {
parse: {querystring: {}},
stringify: {querystring: {}}
}
qs.parse(str, options)
qs.stringify(obj, options)
Here sep
and eq
are the second and third argument for the querystring's parse
and stringify
methods. The options
key is the forth object argument:
var qs = require('@request/qs')
var options = {
// parse options
parse: {
querystring: {sep: ';', eq: ':', options: {}}
},
// stringify options
stringify: {
querystring: {sep: ';', eq: ':', options: {}}
}
}
qs.parse(str, options)
qs.stringify(obj, options)
The stringified result is RFC3986 encoded.
This module may contain code snippets initially implemented in request by request contributors.