renderRedirect() — astro Function Reference
Architecture documentation for the renderRedirect() function in render.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD db301d98_2cae_ad49_5e45_32ec4a92b278["renderRedirect()"] 257bae1e_85a4_d9fb_5253_5efdfeba739a["render.ts"] db301d98_2cae_ad49_5e45_32ec4a92b278 -->|defined in| 257bae1e_85a4_d9fb_5253_5efdfeba739a 94c0ccaf_805c_68a8_d3eb_cf64e5be918a["redirectRouteGenerate()"] db301d98_2cae_ad49_5e45_32ec4a92b278 -->|calls| 94c0ccaf_805c_68a8_d3eb_cf64e5be918a 845c0f9c_0fb3_6374_3477_0790d24822d4["redirectIsExternal()"] db301d98_2cae_ad49_5e45_32ec4a92b278 -->|calls| 845c0f9c_0fb3_6374_3477_0790d24822d4 style db301d98_2cae_ad49_5e45_32ec4a92b278 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/core/redirects/render.ts lines 15–32
export async function renderRedirect(renderContext: RenderContext) {
const {
request: { method },
routeData,
} = renderContext;
const { redirect, redirectRoute } = routeData;
const status =
redirectRoute && typeof redirect === 'object' ? redirect.status : method === 'GET' ? 301 : 308;
const headers = { location: encodeURI(redirectRouteGenerate(renderContext)) };
if (redirect && redirectIsExternal(redirect)) {
if (typeof redirect === 'string') {
return Response.redirect(redirect, status);
} else {
return Response.redirect(redirect.destination, status);
}
}
return new Response(null, { status, headers });
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does renderRedirect() do?
renderRedirect() is a function in the astro codebase, defined in packages/astro/src/core/redirects/render.ts.
Where is renderRedirect() defined?
renderRedirect() is defined in packages/astro/src/core/redirects/render.ts at line 15.
What does renderRedirect() call?
renderRedirect() calls 2 function(s): redirectIsExternal, redirectRouteGenerate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free