node.js - body-parser - extended option (qs vs querystring) -
in current version of body-parser, extended
option when using bodyparser.urlencoded()
required. in readme, explains:
the extended option allows choose between parsing url-encoded data querystring library (when false) or qs library (when true).
[...]
defaults true, using default has been deprecated. please research difference between qs , querystring , choose appropriate setting.
i couldn't find helpful or specific information on this. found deprecated node-querystring.
should option true?
the reason message body-parser
about change default value extended
true
false
.
extended protocol uses qs
library parse x-www-form-urlencoded
data. main advantage of qs
uses powerful serialization/deserialization algorithm, capable of serializing json-like data structure.
but web-browsers don't use protocol, because x-www-form-urlencoded
designed serialize flat html forms. though, may come in handy if you're going send rich data structures using ajax
.
querystring
library` provides basic serialization/deserialization algorithm, 1 used web-browsers serialize form data. basic algorithm simpler extended one, limited flat data structures.
both algorithms work same flat data.
now, when know pros , cons of both algorithms, it's decide 1 suits application better.
Comments
Post a Comment