//code...
const Koa = require('koa');
const koaBody = require("koa-body");
app.use(koaBody({
multipart: true,
formidable: {
maxFileSize: 200 * 1024 * 1024
}
}))
//...code
//...code
app.use(koaBody({
multipart: true,
strict:false,//设为false
formidable: {
maxFileSize: 200 * 1024 * 1024
}
}))
//...code
// 前端请求(jquery)
$.ajax({
url:`${baseUrl}/xxx`,
type:"DELETE",
headers:{
"content-type":"application/json"
},
data:{
name:"小明",
age:18
}
}).then(res=>{
console.log(res);
})
// 后端处理函数部分
const fn_testDelete=async(ctx,next)=>{
const {name,age}=ctx.request.body;
console.log(name,age);//小明 18
ctx.response.body={
code:200,
errMsg:"OK"
}
}