Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async execute(ctx: Context) {
await super.execute(ctx)
const isFile = !!mime.lookup(this.body)
if (!isFile)
throw new HttpStatusError(HttpStatus.NotFound)
ctx.type = extname(this.body)
const sendFile = ctx.config.sendFile || ((path: string, opt?: ServeStaticOptions) => send(ctx, path, opt))
await sendFile(this.body, this.opt)
}
}