koa-body默认delete方法是不会解析body参数的,需要加以开启配置:
const Koa = require('koa');
const body = require('koa-body');
const app = new Koa();
// 可以给parsedMethods传想要koa-body解析的方法
app.use(body({parsedMethods: ['POST', 'PUT', 'PATCH', 'GET', 'HEAD', 'DELETE']}));
app.use(async function(ctx) {
ctx.body = '123123';
});
app.listen(3001);