Returns a response with the specified HTTP status code with an optional message.
The sendStatus()
function is used in the router()
, beforeRouter()
,
and afterRouter()
hooks to return a specified response.
Optionally, you can pass a message.
function sendStatus(
statusCode: string,
message: string,
): Promise<WixRouterResponse>;
The HTTP status code to return.
The message to write as the HTTP body.
import { sendStatus } from "wix-router";
export function myRouter_Router(request) {
return sendStatus("418");
}
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.