Skip to content

Commit 6eeb20c

Browse files
Revert "feat: support overwriting default 404 handler (#3081)" (#3093)
This reverts commit 0b3546f. Reverting this because it will be superseded by #3086
1 parent 31dcbfb commit 6eeb20c

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

src/app.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,7 @@ export class App<State> {
245245
return this;
246246
}
247247

248-
/**
249-
* Create handler function for `Deno.serve` or to be used in
250-
* testing.
251-
* @param {() => Promise<Response>} [nextFn] overwrite default 404 handler
252-
* @returns {Deno.ServeHandler}
253-
*/
254-
handler(nextFn?: () => Promise<Response>): (
248+
handler(): (
255249
request: Request,
256250
info?: Deno.ServeHandlerInfo,
257251
) => Promise<Response> {
@@ -282,7 +276,7 @@ export class App<State> {
282276

283277
const next = matched.patternMatch && !matched.methodMatch
284278
? DEFAULT_NOT_ALLOWED_METHOD
285-
: nextFn ?? DEFAULT_NOT_FOUND;
279+
: DEFAULT_NOT_FOUND;
286280

287281
const { params, handlers, pattern } = matched;
288282
const ctx = new FreshReqContext<State>(

src/app_test.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -532,15 +532,3 @@ Deno.test("App - adding Island should convert to valid export names", () => {
532532
fn: component3,
533533
});
534534
});
535-
536-
Deno.test("App - overwrite default 404 handler", async () => {
537-
const app = new App().get("/foo", () => new Response("foo"));
538-
539-
const server = new FakeServer(
540-
app.handler(() => Promise.resolve(new Response("bar"))),
541-
);
542-
543-
const res = await server.get("/invalid");
544-
const text = await res.text();
545-
expect(text).toEqual("bar");
546-
});

0 commit comments

Comments
 (0)