rsnext/test/e2e/testmode/middleware.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
327 B
JavaScript
Raw Normal View History

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),
},
})
}