koajs / koa-body

koa body parser middleware
MIT License
950 stars 130 forks source link

form-data not supper object ?? #81

Closed exvu closed 6 years ago

exvu commented 6 years ago

today,I found a issue when using form-data,this middleware not parse object like

qq20180315-132319 2x

i found cource code

qq20180315-133527 2x

Seems to only support

Excuse me, my English is poor.

chang-ke commented 6 years ago

I guess you should convert object to string like {id:2, name:Tom} => "id=2&name=Tom" or not use Content-Type: application/x-www-form-urlencoded but application/json

MarkHerhold commented 6 years ago

@xuan45 is correct. As far as I know form data is always a flat structure. If you wish to inflate the data into a nested JSON object, you will have to do this yourself or just use JSON.