/* eslint-disable @typescript-eslint/no-unsafe-argument */ import {Context} from 'egg'; export default (): (ctx: Context, next: () => Promise) => Promise => { return async (ctx: Context, next: () => Promise) => { return new Promise((resolve) => { const data = new Array(); ctx.req.on('data', (chunk: Buffer) => data.push(chunk)); ctx.req.on('end', async () => { ctx.bufferBody = data; await next(); resolve(); }); }); }; };