/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
test/e2e/edge-runtime-dynamic-code/middleware.js
55 строк
1 KB
Tim Neutkens
Convert test/integration to isolated tests (#93247)
11 май 2026, 14:55
Не верифицирован
11 май 2026, 14:55
8141dcf
Код
Авторство
О чём код?
import { NextResponse } from 'next/server' import { notUsingEval, usingEval } from './lib/utils' import { usingWebAssemblyCompile, usingWebAssemblyInstantiate, usingWebAssemblyInstantiateWithBuffer, } from './lib/wasm' export async function middleware(request) { if (request.nextUrl.pathname === '/using-eval') { return new Response(null, { headers: { data: JSON.stringify(await usingEval()) }, }) } if (request.nextUrl.pathname === '/not-using-eval') { return new Response(null, { headers: { data: JSON.stringify(await notUsingEval()) }, }) } if (request.nextUrl.pathname === '/using-webassembly-compile') { return new Response(null, { headers: { data: JSON.stringify(await usingWebAssemblyCompile(9)) }, }) } if (request.nextUrl.pathname === '/using-webassembly-instantiate') { return new Response(null, { headers: { data: JSON.stringify(await usingWebAssemblyInstantiate(9)) }, }) } if ( request.nextUrl.pathname === '/using-webassembly-instantiate-with-buffer' ) { return new Response(null, { headers: { data: JSON.stringify(await usingWebAssemblyInstantiateWithBuffer(9)), }, }) } return NextResponse.next() } export const config = { matcher: [ '/using-eval', '/not-using-eval', '/using-webassembly-compile', '/using-webassembly-instantiate', '/using-webassembly-instantiate-with-buffer', ], }