中间件未返回响应。
MiddlewareNoDataOrNextCalled:确保你的中间件返回
Response对象,无论是直接返回还是通过调用next函数返回Response。¥MiddlewareNoDataOrNextCalled: Make sure your middleware returns a
Responseobject, either directly or by returning theResponsefrom calling thenextfunction.
什么地方出了错?
Section titled “什么地方出了错?”¥What went wrong?
当中间件没有返回任何数据或调用 next 函数时抛出。
¥Thrown when the middleware does not return any data or call the next function.
例如:
¥For example:
import {defineMiddleware} from "astro:middleware";export const onRequest = defineMiddleware((context, _) => { // doesn't return anything or call `next` context.locals.someData = false;});