Home / Function/ writeRedirectResponse() — astro Function Reference

writeRedirectResponse() — astro Function Reference

Architecture documentation for the writeRedirectResponse() function in response.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  c52fc1c6_e9a2_191d_c075_552c4d25c3c1["writeRedirectResponse()"]
  4611d913_9978_903f_46fc_e5961ccf4da7["response.ts"]
  c52fc1c6_e9a2_191d_c075_552c4d25c3c1 -->|defined in| 4611d913_9978_903f_46fc_e5961ccf4da7
  style c52fc1c6_e9a2_191d_c075_552c4d25c3c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/vite-plugin-astro-server/response.ts lines 39–56

export function writeRedirectResponse(
	res: http.ServerResponse,
	statusCode: number,
	location: string,
) {
	const html = redirectTemplate({
		status: statusCode,
		absoluteLocation: location,
		relativeLocation: location,
	});
	res.writeHead(statusCode, {
		Location: location,
		'Content-Type': 'text/html',
		'Content-Length': Buffer.byteLength(html, 'utf-8'),
	});
	res.write(html);
	res.end();
}

Domain

Subdomains

Frequently Asked Questions

What does writeRedirectResponse() do?
writeRedirectResponse() is a function in the astro codebase, defined in packages/astro/src/vite-plugin-astro-server/response.ts.
Where is writeRedirectResponse() defined?
writeRedirectResponse() is defined in packages/astro/src/vite-plugin-astro-server/response.ts at line 39.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free