From 53657358e398297b0dbf99690be79b3a7047c4c3 Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Sun, 7 Jul 2024 22:29:03 +0800 Subject: [PATCH] fix: export handleRequest on application --- .eslintrc | 3 +-- Readme.md | 10 ++++++---- src/application.ts | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9bcdb4688..98f9236ae 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,5 @@ { "extends": [ - "eslint-config-egg/typescript", - "eslint-config-egg/lib/rules/enforce-node-prefix" + "eslint-config-egg/typescript" ] } diff --git a/Readme.md b/Readme.md index 08e3d568a..a91b74bef 100644 --- a/Readme.md +++ b/Readme.md @@ -170,10 +170,6 @@ npm test To report a security vulnerability, please do not open an issue, as this notifies attackers of the vulnerability. Instead, please email [fengmk2](mailto:fengmk2+eggjs@gmail.com) to disclose. -## Authors - -See [AUTHORS](AUTHORS). - ## Community - [Examples](https://github.com/koajs/examples) @@ -184,3 +180,9 @@ See [AUTHORS](AUTHORS). ## License [MIT](LICENSE) + +## Contributors + +[![Contributors](https://contrib.rocks/image?repo=eggjs/koa)](https://github.com/eggjs/koa/graphs/contributors) + +Made with [contributors-img](https://contrib.rocks). diff --git a/src/application.ts b/src/application.ts index ce4cfcd7e..aca15b935 100644 --- a/src/application.ts +++ b/src/application.ts @@ -168,7 +168,7 @@ export class Application extends Emitter { const handleRequest = (req: IncomingMessage, res: ServerResponse) => { const ctx = this.createContext(req, res); return this.ctxStorage.run(ctx, async () => { - return await this.#handleRequest(ctx, fn); + return await this.handleRequest(ctx, fn); }); }; @@ -186,7 +186,7 @@ export class Application extends Emitter { * Handle request in callback. * @private */ - async #handleRequest(ctx: ContextDelegation, fnMiddleware: (ctx: ContextDelegation) => Promise) { + protected async handleRequest(ctx: ContextDelegation, fnMiddleware: (ctx: ContextDelegation) => Promise) { const res = ctx.res; res.statusCode = 404; const onerror = (err: any) => ctx.onerror(err);