Home / Type/ RenderOptions Type — astro Architecture

RenderOptions Type — astro Architecture

Architecture documentation for the RenderOptions type/interface in base.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  59b13f22_87a9_43d5_5929_7b7c7c33f91e["RenderOptions"]
  be39cf2a_62a6_9604_4324_ee218d601bab["base.ts"]
  59b13f22_87a9_43d5_5929_7b7c7c33f91e -->|defined in| be39cf2a_62a6_9604_4324_ee218d601bab
  style 59b13f22_87a9_43d5_5929_7b7c7c33f91e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/app/base.ts lines 39–83

export interface RenderOptions {
	/**
	 * Whether to automatically add all cookies written by `Astro.cookie.set()` to the response headers.
	 *
	 * When set to `true`, they will be added to the `Set-Cookie` header as comma-separated key=value pairs. You can use the standard `response.headers.getSetCookie()` API to read them individually.
	 *
	 * When set to `false`, the cookies will only be available from `App.getSetCookieFromResponse(response)`.
	 *
	 * @default {false}
	 */
	addCookieHeader?: boolean;

	/**
	 * The client IP address that will be made available as `Astro.clientAddress` in pages, and as `ctx.clientAddress` in API routes and middleware.
	 *
	 * Default: `request[Symbol.for("astro.clientAddress")]`
	 */
	clientAddress?: string;

	/**
	 * The mutable object that will be made available as `Astro.locals` in pages, and as `ctx.locals` in API routes and middleware.
	 */
	locals?: object;

	/**
	 * A custom fetch function for retrieving prerendered pages - 404 or 500.
	 *
	 * If not provided, Astro will fallback to its default behavior for fetching error pages.
	 *
	 * When a dynamic route is matched but ultimately results in a 404, this function will be used
	 * to fetch the prerendered 404 page if available. Similarly, it may be used to fetch a
	 * prerendered 500 error page when necessary.
	 *
	 * @param {ErrorPagePath} url - The URL of the prerendered 404 or 500 error page to fetch.
	 * @returns {Promise<Response>} A promise resolving to the prerendered response.
	 */
	prerenderedErrorPageFetch?: (url: ErrorPagePath) => Promise<Response>;

	/**
	 * **Advanced API**: you probably do not need to use this.
	 *
	 * Default: `app.match(request)`
	 */
	routeData?: RouteData;
}

Frequently Asked Questions

What is the RenderOptions type?
RenderOptions is a type/interface in the astro codebase, defined in packages/astro/src/core/app/base.ts.
Where is RenderOptions defined?
RenderOptions is defined in packages/astro/src/core/app/base.ts at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free