Skip to content

Commit

Permalink
fix: mark app._handle as private to avoid sub-app detection
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 23, 2020
1 parent 0e4770a commit 1439f35
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import { send, createError, sendError, MIMES, stripTrailingSlash } from './utils
export function createApp (options: AppOptions = {}): App {
const stack: Stack = []

const handle = createHandle(stack)
const _handle = createHandle(stack)

// @ts-ignore
const app: Partial<App> = function (req: IncomingMessage, res: ServerResponse) {
return handle(req, res)
return _handle(req, res)
.catch((err: Error | any) => { sendError(res, err, options.debug) })
}

app.stack = stack
app.handle = handle
app._handle = _handle

// @ts-ignore
app.use = (arg1, arg2, arg3) => use(app, arg1, arg2, arg3)
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface AppUse {
export interface App {
(req: IncomingMessage, res: ServerResponse): Promise<any>
stack: Stack
handle: PHandle
_handle: PHandle
use: AppUse
useAsync: AppUse
}
Expand Down

0 comments on commit 1439f35

Please sign in to comment.