HttpStatusCode

HttpStatusCode sets the response status code on the server.


Import

import { HttpStatusCode } from "@solidjs/start";

Type

interface HttpStatusCodeProps {
code: number;
text?: string;
}
const HttpStatusCode: (props: HttpStatusCodeProps) => null;

Props

code

  • Type: number
  • Optional: No

HTTP status code assigned to the response.

text

  • Type: string
  • Optional: Yes

HTTP status text assigned to the response.


Behavior

  • event.response.status is set to code and event.response.statusText to text.
  • Cleanup resets the status to 200 when the event is not complete.
  • Client rendering returns null.

Examples

Basic usage

import { HttpStatusCode } from "@solidjs/start";
export default function NotFound() {
return <HttpStatusCode code={404} />;
}
Last updated: 7/4/26, 5:28 PMEdit this pageReport an issue with this page