Skip to content
Download

status

mach::Response::status

Sets the response status code.

Sets the HTTP status code used in the response.

void status(http::StatusCode status);
Parameter Description
status The status code to set.
Exception Condition
std::invalid_argument Thrown if the specified status code is not supported by Mach.

This function is not thread-safe.

response().status(http::StatusCode::NotFound);
Name Description
StatusCode Represents an HTTP status code.
status Returns the response status code.