Skip to content

IServerRendererResult

David Ortner edited this page Sep 23, 2025 · 2 revisions

IServerRendererResult represents the result of a server-side rendering operation.

Signature

interface IServerRendererResult

Example

import { ServerRenderer } from "@happy-dom/server-renderer";
import type { IServerRendererResult } from "@happy-dom/server-renderer";

const renderer = new ServerRenderer();

const results: IServerRendererResult[] = await renderer.render([
	"https://example.com",
]);

// The rendered HTML
console.log(results[0].url);
console.log(results[0].content);

Properties

Property Type Default Description
url string The URL of the rendered document.
content string | null The serialized HTML content of the rendered document. If output to a file, this will be null.
status number The HTTP status code of the response.
statusText string The HTTP status text of the response.
headers Record<string, string> An object containing the HTTP headers of the response.
outputFile string | null The path to the output file if the content was saved to a file, otherwise null.
error string | null An error message if an error occurred during rendering, otherwise null.
pageErrors string[] An array of error messages that occurred on the page during rendering.
pageConsole string A concatenated string of all console messages from the page during rendering.
Clone this wiki locally