StatusCode
Enum StatusCode.
Description
Defines HTTP status codes in accordance with the IETF RFC 9110 and related specifications. This enum provides a structured representation of common HTTP response codes, grouped by their respective categories:
- Informational (1xx)
- Successful (2xx)
- Redirection (3xx)
- Client Errors (4xx)
- Server Errors (5xx)
All status codes MUST adhere to the official HTTP specification and SHALL be used consistently within HTTP responses.
Cases
Methods
Returns the category of the status code.
Returns the numeric HTTP status code.
Returns a human-readable description of the status code.
Returns true if the status code indicates a client error (4xx).
Returns true if the status code indicates any type of error (client or server).
Returns true if the status code is informational (1xx).
Returns true if the status code indicates redirection (3xx).
Returns true if the status code indicates a server error (5xx).
Returns true if the status code indicates success (2xx).
Returns the category of the status code.
public
getCategory() : string
Description
Categories are based on the first digit of the status code:
- 1: Informational
- 2: Success
- 3: Redirection
- 4: Client Error
- 5: Server Error
Return values
Returns the numeric HTTP status code.
public
getCode() : int
Return values
Description
the numeric status code as defined by the HTTP specification
Returns a human-readable description of the status code.
public
getReasonPhrase() : string
Description
The description is derived from the enum name, replacing underscores with spaces and capitalizing each word.
Return values
Description
the reason phrase corresponding to the status code
Returns true if the status code indicates a client error (4xx).
public
isClientError() : bool
Return values
Returns true if the status code indicates any type of error (client or server).
public
isError() : bool
Return values
Returns true if the status code is informational (1xx).
public
isInformational() : bool
Return values
Returns true if the status code indicates redirection (3xx).
public
isRedirection() : bool
Return values
Returns true if the status code indicates a server error (5xx).
public
isServerError() : bool
Return values
Returns true if the status code indicates success (2xx).
public
isSuccess() : bool