MCPcopy
hub / github.com/vercel/next.js / getRedirectStatus

Function getRedirectStatus

packages/next/src/lib/redirect-status.ts:5–15  ·  view source on GitHub ↗
(route: {
  statusCode?: number
  permanent?: boolean
})

Source from the content-addressed store, hash-verified

3export const allowedStatusCodes = new Set([301, 302, 303, 307, 308])
4
5export function getRedirectStatus(route: {
6 statusCode?: number
7 permanent?: boolean
8}): number {
9 return (
10 route.statusCode ||
11 (route.permanent
12 ? RedirectStatusCode.PermanentRedirect
13 : RedirectStatusCode.TemporaryRedirect)
14 )
15}
16
17// for redirects we restrict matching /_next and for all routes
18// we add an optional trailing slash at the end for easier

Callers 5

buildCustomRouteFunction · 0.90
renderToHTMLImplFunction · 0.90
handleRouteFunction · 0.90
handleRedirectFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected