Skip to content

Commit

Permalink
drop handled
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 26, 2024
1 parent e786026 commit 63f7b73
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
4 changes: 1 addition & 3 deletions src/adapters/node/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export class NodeEvent implements RawEvent {
_req: NodeIncomingMessage;
_res: NodeServerResponse;

_handled?: boolean;

_originalPath?: string | undefined;

_rawBody?: Promise<undefined | Uint8Array>;
Expand Down Expand Up @@ -125,7 +123,7 @@ export class NodeEvent implements RawEvent {
// -- response --

get handled() {
return this._handled || this._res.writableEnded || this._res.headersSent;
return this._res.writableEnded || this._res.headersSent;
}

get responseCode() {
Expand Down
7 changes: 0 additions & 7 deletions src/adapters/web/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export class WebEvent implements RawEvent {

_req: Request;

_handled?: boolean;

_path?: string;
_originalPath?: string | undefined;

Expand Down Expand Up @@ -106,10 +104,6 @@ export class WebEvent implements RawEvent {

// -- response --

get handled() {
return this._handled;
}

get responseCode() {
return this._responseCode || 200;
}
Expand Down Expand Up @@ -155,7 +149,6 @@ export class WebEvent implements RawEvent {
}

writeHead(code: number, message?: string) {
this._handled = true;
if (code) {
this.responseCode = code;
}
Expand Down
3 changes: 0 additions & 3 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ async function _callHandler<
if (hooks.onRequest) {
for (const hook of hooks.onRequest) {
await hook(event);
if (event[_kRaw].handled) {
return;
}
}
}
const body = await handler(event);
Expand Down
2 changes: 0 additions & 2 deletions src/types/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ export interface RawEvent {

// -- Response --

readonly handled: boolean | undefined;

responseCode: number | undefined;
responseMessage: string | undefined;

Expand Down

0 comments on commit 63f7b73

Please sign in to comment.