Files
next.js/test/integration/edge-runtime-dynamic-code/pages/api/route.js
Niklas MischkulnigandGitHub 7861621f58 test: Refactor edge-runtime-dynamic-code test (#83390)
This test is about `eval`
But it also used a non-static middleware `matchers` config, which is going to break once we are more strict about this and throw a build error.
2025-09-03 23:22:16 +02:00

35 lines
932 B
JavaScript

import { notUsingEval, usingEval } from '../../lib/utils'
import {
usingWebAssemblyCompile,
usingWebAssemblyInstantiate,
usingWebAssemblyInstantiateWithBuffer,
} from '../../lib/wasm'
export default async function handler(request) {
const useCase = request.nextUrl.searchParams.get('case')
if (useCase === 'using-eval') {
return Response.json(await usingEval())
}
if (useCase === 'not-using-eval') {
return Response.json(await notUsingEval())
}
if (useCase === 'using-webassembly-compile') {
return Response.json(await usingWebAssemblyCompile(9))
}
if (useCase === 'using-webassembly-instantiate') {
return Response.json(await usingWebAssemblyInstantiate(9))
}
if (useCase === 'using-webassembly-instantiate-with-buffer') {
return Response.json(await usingWebAssemblyInstantiateWithBuffer(9))
}
return Response.json({ ok: true })
}
export const config = { runtime: 'edge' }