Skip to content
Download

forbidden

mach::forbidden

Creates a Forbidden response.

Creates a 403 Forbidden response, optionally containing the specified value.

// (1)
template <typename T>
[[nodiscard]] mach::Reply<T> forbidden(T value);
// (2)
[[nodiscard]] mach::Reply<std::string> forbidden(const char* value);
// (3)
template <typename T = void>
[[nodiscard]] mach::Reply<T> forbidden();

A Forbidden reply containing the specified value.

A Forbidden reply containing the specified string.

A Forbidden reply with no value.

Parameter Description
T The type of the response body.
Parameter Description
T The reply value type used to match the endpoint’s return type. Defaults to void.
Parameter Description
value The response body.
Parameter Description
value The response body.

Overload (2) converts the specified value to a std::string.

return mach::forbidden(error);
return mach::forbidden("Access denied.");
return mach::forbidden();
Name Description
Reply Represents the result of an HTTP endpoint.
ControllerBase::forbidden Creates a Forbidden response from a controller.