Skip to content

Commit

Permalink
fix: export handleRequest on application
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jul 7, 2024
1 parent 5db7a9e commit 5365735
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extends": [
"eslint-config-egg/typescript",
"eslint-config-egg/lib/rules/enforce-node-prefix"
"eslint-config-egg/typescript"
]
}
10 changes: 6 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]) to disclose.

## Authors

See [AUTHORS](AUTHORS).

## Community

- [Examples](https://github.com/koajs/examples)
Expand All @@ -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).
4 changes: 2 additions & 2 deletions src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand All @@ -186,7 +186,7 @@ export class Application extends Emitter {
* Handle request in callback.
* @private
*/
async #handleRequest(ctx: ContextDelegation, fnMiddleware: (ctx: ContextDelegation) => Promise<void>) {
protected async handleRequest(ctx: ContextDelegation, fnMiddleware: (ctx: ContextDelegation) => Promise<void>) {
const res = ctx.res;
res.statusCode = 404;
const onerror = (err: any) => ctx.onerror(err);
Expand Down

0 comments on commit 5365735

Please sign in to comment.