sendStatus( )


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.

Method Declaration
Copy
function sendStatus(
  statusCode: string,
  message: string,
): Promise<WixRouterResponse>;
Method Parameters
statusCodestringRequired

The HTTP status code to return.


messagestring

The message to write as the HTTP body.

Returns
Return Type:Promise<WixRouterResponse>
JavaScript
import { sendStatus } from "wix-router"; export function myRouter_Router(request) { return sendStatus("418"); }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?