中间件未返回响应。
MiddlewareNoDataOrNextCalled:确保你的中间件返回
Response
对象,无论是直接返回还是通过调用next
函数返回Response
。¥MiddlewareNoDataOrNextCalled: Make sure your middleware returns a
Response
object, either directly or by returning theResponse
from calling thenext
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;});