koajs / bodyparser

Koa body parsing middleware
MIT License
1.31k stars 116 forks source link

post array more than 21 #57

Closed ahan closed 7 years ago

ahan commented 7 years ago

I have two Nodejs Apps: App A and App B App A post array data to App B

Like this:

let list = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20' ]
request({
     method: 'POST',
     url,
     form: {
          list: list,
     }
}, function...)

App B get the array perfect screen shot 2016-10-21 at 6 10 48 pm

But if we change the "list" to a array, which length more than 21, something weird happened.

let list = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21' ]

screen shot 2016-10-21 at 6 09 57 pm App B get a array something like map.

I googled the keywords, like "post array 21", "post array to object", can't find useful infomations.

I kind of confused, is there anyone who know the reason about this?

Environment Nodejs: v6.6.0 Koa: 2.0.0 koa-bodyparser: 3.2.0 Request: 2.74.0

dead-horse commented 7 years ago

please define your own rules by options.querystring, the default is https://github.com/ljharb/qs/blob/master/lib/parse.js#L7