Skip to content
Download

StatusCode

mach::StatusCode

Represents an HTTP response status code.

Primary header:

#include <mach/http/StatusCode.hpp>

Convenience header:

#include <mach/mach.hpp>
enum class StatusCode {
Ok = 200,
Created = 201,
Accepted = 202,
NonAuthoritativeInformation = 203,
NoContent = 204,
PartialContent = 206,
MovedPermanently = 301,
Found = 302,
TemporaryRedirect = 307,
PermanentRedirect = 308,
BadRequest = 400,
Unauthorized = 401,
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
RequestTimeout = 408,
Conflict = 409,
PayloadTooLarge = 413,
UriTooLong = 414,
UnsupportedMediaType = 415,
RequestHeaderFieldsTooLarge = 431,
InternalServerError = 500,
NotImplemented = 501,
HttpVersionNotSupported = 505
};
Name Value Description
Ok 200 Indicates that the request completed successfully.
Created 201 Indicates that a new resource was created successfully.
Accepted 202 Indicates that the request has been accepted for processing.
NonAuthoritativeInformation 203 Indicates that the returned information was obtained from a transforming proxy.
NoContent 204 Indicates that the request completed successfully with no response body.
PartialContent 206 Indicates that the response contains only part of the requested resource.
MovedPermanently 301 Indicates that the requested resource has been permanently moved.
Found 302 Indicates that the requested resource is temporarily available at a different location.
TemporaryRedirect 307 Indicates that the requested resource is temporarily available at a different location while preserving the request method.
PermanentRedirect 308 Indicates that the requested resource has been permanently moved while preserving the request method.
BadRequest 400 Indicates that the request is invalid.
Unauthorized 401 Indicates that authentication is required or has failed.
Forbidden 403 Indicates that the request is understood but not permitted.
NotFound 404 Indicates that the requested resource could not be found.
MethodNotAllowed 405 Indicates that the HTTP method is not allowed for the requested resource.
RequestTimeout 408 Indicates that the server timed out waiting for the request.
Conflict 409 Indicates that the request conflicts with the current state of the resource.
PayloadTooLarge 413 Indicates that the request payload exceeds the allowed size.
UriTooLong 414 Indicates that the request target is too long.
UnsupportedMediaType 415 Indicates that the request media type is not supported.
RequestHeaderFieldsTooLarge 431 Indicates that the request headers exceed the allowed size.
InternalServerError 500 Indicates that an unexpected server error occurred.
NotImplemented 501 Indicates that the requested functionality is not implemented.
HttpVersionNotSupported 505 Indicates that the HTTP version is not supported.
Function Description
reasonPhrase Returns the standard HTTP reason phrase for a StatusCode.
isValidStatusCode Determines whether a status code is recognized by Mach.

StatusCode is used by Response and Reply to represent HTTP response status codes.

Name Description
Response Represents the HTTP response being built.
Results Creates HTTP responses from route handlers.