Skip to content

中间件未返回响应。

MiddlewareNoDataOrNextCalled:确保你的中间件返回 Response 对象,无论是直接返回还是通过调用 next 函数返回 Response

¥MiddlewareNoDataOrNextCalled: Make sure your middleware returns a Response object, either directly or by returning the Response from calling the next function.

¥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;
});
Astro 中文网 - 粤ICP备13048890号