fix: bring back support for middleware Array (#3434)
Our validation didn't account for `_middleware` files exporting an Array of middlewares. Fixes https://github.com/denoland/fresh/issues/3400
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { Middleware } from "@fresh/core";
|
||||
|
||||
const middleware1: Middleware<{ text: string }> = async (ctx) => {
|
||||
ctx.state.text = "A";
|
||||
return await ctx.next();
|
||||
};
|
||||
|
||||
const middleware2: Middleware<{ text: string }> = async (ctx) => {
|
||||
ctx.state.text += "B";
|
||||
return await ctx.next();
|
||||
};
|
||||
|
||||
export default [middleware1, middleware2];
|
||||
@@ -0,0 +1,4 @@
|
||||
import type { HandlerFn } from "@fresh/core";
|
||||
|
||||
export const handler: HandlerFn<null, { text: string }> = (ctx) =>
|
||||
new Response(ctx.state.text);
|
||||
Reference in New Issue
Block a user