rsnext/test/e2e/testmode/middleware.js
Dima Voytenko 7852224b6a
Testmode: support edge functions inside a sandbox (#59179)
Testmode is refactored to support both serverless and edge functions
under a sandbox.
2023-12-04 16:47:34 -08:00

14 lines
327 B
JavaScript

import { NextResponse } from 'next/server'
export const config = {
matcher: ['/app/rsc-fetch'],
}
export async function middleware() {
const text = await (await fetch('https://example.com/middleware')).text()
return NextResponse.next({
headers: {
'x-middleware-fetch': encodeURIComponent(text),
},
})
}