Open jackchoumine opened 2 years ago
verssions:
"koa": "^2.13.1", "koa-bodyparser": "^4.3.0", "koa2-formidable": "^1.0.3",
send array json with fetch:
fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json;charset=utf-8', }, body: JSON.stringify([{name:'test'}]), }) .then(res => res.json()) .then(res => { console.log(res) }) .catch(e => { console.log(e) })
app:
app.use(formidable()) app.use( bodyParser({ formLimit: '50mb', jsonLimit: '50mb', textLimit: '50mb', }) )
receive a object from endpoint .
const { body } = ctx.request // body is object
when i remove app.use(formidable()) body is array.
app.use(formidable())
i have the same issue
verssions:
send array json with fetch:
app:
receive a object from endpoint .
when i remove
app.use(formidable())
body is array.