RouteHandlerViewResponse

A RouteHandlerViewResponse can be a ViewDefinitionResponse object or a ViewResponse object.

ViewDefinitionResponse 

Use this object to customize response input handled by the LWR server.

ViewDefinitionResponse Syntax
1interface ViewDefinitionResponse {
2  status?: number;
3  view: RouteHandlerView;
4  viewParams: Record<string, Json>
5  renderOptions?: RenderOptions;
6  cache?: CacheResponse;
7  headers?: Record<string, string>
8}
PropertyTypeRequired/OptionalDescription
statusNumberOptionalThe HTTP response status code.
viewRouteHandlerViewRequiredA partial route.
viewParamsRecord<string, Json>RequiredThe record is passed into the templates as dynamic content.
renderOptionsRenderOptionsOptionalConfigure settings for metadata collection, embedded asset URLs, and caching the page view response.
cacheCacheResponseOptionalPage caching settings.
headersRecord<string, string>OptionalHTTP headers.

RenderOptions 

RenderOptions Syntax
1interface RenderOptions {
2    skipMetadataCollection?: boolean;
3    freezeAssets?: boolean;
4    skipCaching?: boolean;
5}
PropertyTypeRequired/OptionalDescription
skipMetadataCollectionBooleanOptionalTo skip parsing of body for <link> and <img> tags, set to true. The default value is false.
freezeAssetsBooleanOptionalTo construct immutable URLs for embedded assets, set this value to true. The default value is set to runtimeEnvironment.immutableAssets.
skipCachingBooleanOptionalTo not cache the page view response, set this value to true. The default value is false.

CacheResponse 

CacheResponse Syntax
1interface CacheResponse {
2    ttl?: string | number;
3}
PropertyTypeRequired/OptionalDescription
ttlString/NumberOptionalSet the "max-age” for the "Cache-Control" header.

ViewResponse 

Use this object to return a completely custom response override.

ViewResponse Syntax
1interface ViewResponse {
2    status?: number;
3    body: Buffer | string | boolean | Json;
4    cache?: CacheResponse;
5    headers?: Record<string, string>;
6}
PropertyTypeRequired/OptionalDescription
statusNumberOptionalThe HTTP response status code.
bodyBuffer/string/boolean/jsonRequiredThe response body.
cacheCacheResponseOptionalPage caching settings.
headersRecord<string, string>OptionalHTTP headers.

See Also

Developer Preview Feature

Feature is available as a developer preview. Feature is not generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Do not implement functionality developed with these commands or tools.

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!