Files
JJ KasperandGitHub 78f73b2706 Handle encoded params further (#91627)
Continues https://github.com/vercel/next.js/pull/91603 applying the
encoding normalization further and narrows in a better regression test
separate of root params and specific to vary params flag.
2026-03-19 19:39:33 +00:00

23 lines
637 B
TypeScript

import type { NextApiRequest, NextApiResponse } from 'next'
export default async function handler(
req: NextApiRequest,
res: NextApiResponse<{ revalidated: boolean }>
) {
const pathParam = req.query['path']
if (!pathParam) {
return res.status(400).json({ revalidated: false })
}
const paths = Array.isArray(pathParam) ? pathParam : [pathParam]
try {
await Promise.all(paths.map((path) => res.revalidate(path)))
return res.status(200).json({ revalidated: true })
} catch (error) {
console.error('Failed to revalidate paths:', paths, error)
return res.status(500).json({ revalidated: false })
}
}