Skip to content

Commit ac84ca5

Browse files
committed
refactor: remove override callback
1 parent 4c10168 commit ac84ca5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/koa-api/src/koa-api.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,16 @@ export class KoaApi extends Koa {
5555
async run(req: NextApiRequest, res: NextApiResponse) {
5656
const p = new Promise((resolve) => onFinished(res, resolve))
5757

58-
this.callback()(req, res) as unknown as Promise<void>
59-
60-
return p
61-
}
62-
63-
override callback() {
6458
if (this.firstRun) {
6559
this.firstRun = false
6660
this.use(this.router.routes()).use(
6761
this.router.allowedMethods(this.options.routerAllowedMethods)
6862
)
6963
}
7064

71-
return super.callback()
65+
this.callback()(req, res) as unknown as Promise<void>
66+
67+
return p
7268
}
7369

7470
createNewRouter(opts?: RouterOptions) {

0 commit comments

Comments
 (0)