diff --git a/packages/fresh/src/app.ts b/packages/fresh/src/app.ts index 0c0e88bd..e0102b83 100644 --- a/packages/fresh/src/app.ts +++ b/packages/fresh/src/app.ts @@ -257,7 +257,7 @@ export class App { route: MaybeLazy>, config?: RouteConfig, ): this { - this.#commands.push(newRouteCmd(path, route, config, false)); + this.#commands.push(newRouteCmd(path, route, config, true)); return this; } @@ -265,42 +265,42 @@ export class App { * Add middlewares for GET requests at the specified path. */ get(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("GET", path, middlewares, false)); + this.#commands.push(newHandlerCmd("GET", path, middlewares, true)); return this; } /** * Add middlewares for POST requests at the specified path. */ post(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("POST", path, middlewares, false)); + this.#commands.push(newHandlerCmd("POST", path, middlewares, true)); return this; } /** * Add middlewares for PATCH requests at the specified path. */ patch(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("PATCH", path, middlewares, false)); + this.#commands.push(newHandlerCmd("PATCH", path, middlewares, true)); return this; } /** * Add middlewares for PUT requests at the specified path. */ put(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("PUT", path, middlewares, false)); + this.#commands.push(newHandlerCmd("PUT", path, middlewares, true)); return this; } /** * Add middlewares for DELETE requests at the specified path. */ delete(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("DELETE", path, middlewares, false)); + this.#commands.push(newHandlerCmd("DELETE", path, middlewares, true)); return this; } /** * Add middlewares for HEAD requests at the specified path. */ head(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("HEAD", path, middlewares, false)); + this.#commands.push(newHandlerCmd("HEAD", path, middlewares, true)); return this; } @@ -308,7 +308,7 @@ export class App { * Add middlewares for all HTTP verbs at the specified path. */ all(path: string, ...middlewares: MaybeLazy>[]): this { - this.#commands.push(newHandlerCmd("ALL", path, middlewares, false)); + this.#commands.push(newHandlerCmd("ALL", path, middlewares, true)); return this; } diff --git a/packages/fresh/src/app_test.tsx b/packages/fresh/src/app_test.tsx index 5087586a..67563b9f 100644 --- a/packages/fresh/src/app_test.tsx +++ b/packages/fresh/src/app_test.tsx @@ -824,7 +824,7 @@ Deno.test("App - .appWrapper()", async () => { expect(await res.text()).toContain("app/index<"); }); -Deno.test.ignore("App - .layout()", async () => { +Deno.test("App - .layout()", async () => { const app = new App() .layout("/", ({ Component }) => ( <> @@ -840,7 +840,6 @@ Deno.test.ignore("App - .layout()", async () => { const server = new FakeServer(app.handler()); - // The `/foo` layout is not applied for GET `/foo`, is that correct? const res = await server.get("/foo"); expect(await res.text()).toContain("layout/foo/index<"); });