Skip to content

Configuration ​

query(options?) takes one object, the Options type.

Options ​

OptionTypeDefaultDescription
parseParseOptionsnonePassed to qs parse unchanged

parse ​

The qs IParseOptions. The common ones, with the defaults of qs 6:

PropertyTypeDefaultDescription
depthnumber | false5Maximum nesting depth of bracket keys; deeper keys stay in the key string
arrayLimitnumber20Largest array qs builds: an index of arrayLimit or more (a[20]=x), or more than arrayLimit repeated keys, gives an object with numeric keys
parameterLimitnumber1000Maximum number of parameters parsed; the rest are dropped
throwOnLimitExceededbooleanfalseThrow instead of dropping parameters over parameterLimit or building an object past arrayLimit (an index of arrayLimit or more, or more than arrayLimit repeated keys); depth is not covered
strictDepthbooleanfalseThrow when a key nests deeper than depth
allowDotsbooleanfalseRead a.b=c like a[b]=c
commabooleanfalseSplit a=b,c into ['b', 'c']
parseArraysbooleantrueWith false, a[0]=b gives { a: { 0: 'b' } }
duplicates'combine' | 'first' | 'last''combine'What a repeated key gives: an array, the first or the last value
decoderfunctionqs URI decoderDecodes keys and values; qs itself never turns a value into a number or boolean, a decoder can

The qs documentation lists the others. Parser Options shows a configuration.

The middleware parses every request it runs for, so with throwOnLimitExceeded or strictDepth a query over a limit answers 500 on every route behind query(), also on routes that do not read it.