Kind
The first digit of the status code defines the kind of response.
@frozen enum Kind
The first digit of the status code defines the kind of response.
@frozen enum Kind
import HTTPTypes
A set of version-independent HTTP currency types.
struct Status
The response status consisting of a 3-digit status code and a reason phrase. The reason phrase is ignored by modern HTTP versions.
struct HTTPResponse
An HTTP response message consisting of the “:status” pseudo header field and header fields.
case invalid
The status code is outside the range of 100…599.
case informational
The status code is informational (1xx) and the response is not final.
case successful
The status code is successful (2xx).
case redirection
The status code is a redirection (3xx).
case clientError
The status code is a client error (4xx).
case serverError
The status code is a server error (5xx).
init(code: Int, reasonPhrase: String = "")
Create a custom status from a code and a reason phrase.
init(integerLiteral value: Int)
Create a custom status from an integer literal.
static var accepted: `Self` { get }
202 Accepted
static var badGateway: `Self` { get }
502 Bad Gateway
static var badRequest: `Self` { get }
400 Bad Request
static var conflict: `Self` { get }
409 Conflict
static var contentTooLarge: `Self` { get }
413 Content Too Large
static var `continue`: `Self` { get }
100 Continue
static var created: `Self` { get }
201 Created
static var earlyHints: `Self` { get }
103 Early Hints
static var expectationFailed: `Self` { get }
417 Expectation Failed
static var forbidden: `Self` { get }
403 Forbidden
static var found: `Self` { get }
302 Found
static var gatewayTimeout: `Self` { get }
504 Gateway Timeout
static var gone: `Self` { get }
410 Gone
static var httpVersionNotSupported: `Self` { get }
505 HTTP Version Not Supported
static var internalServerError: `Self` { get }
500 Internal Server Error
static var lengthRequired: `Self` { get }
411 Length Required
static var methodNotAllowed: `Self` { get }
405 Method Not Allowed
static var misdirectedRequest: `Self` { get }
421 Misdirected Request
static var movedPermanently: `Self` { get }
301 Moved Permanently
static var multipleChoices: `Self` { get }
300 Multiple Choices
static var networkAuthenticationRequired: `Self` { get }
511 Network Authentication Required
static var noContent: `Self` { get }
204 No Content
static var nonAuthoritativeInformation: `Self` { get }
203 Non-Authoritative Information
static var notAcceptable: `Self` { get }
406 Not Acceptable
static var notFound: `Self` { get }
404 Not Found
static var notImplemented: `Self` { get }
501 Not Implemented
static var notModified: `Self` { get }
304 Not Modified
static var ok: `Self` { get }
200 OK
static var partialContent: `Self` { get }
206 Partial Content
static var permanentRedirect: `Self` { get }
308 Permanent Redirect
static var preconditionFailed: `Self` { get }
412 Precondition Failed
static var preconditionRequired: `Self` { get }
428 Precondition Required
static var proxyAuthenticationRequired: `Self` { get }
407 Proxy Authentication Required
static var rangeNotSatisfiable: `Self` { get }
416 Range Not Satisfiable
static var requestHeaderFieldsTooLarge: `Self` { get }
431 Request Header Fields Too Large
static var requestTimeout: `Self` { get }
408 Request Timeout
static var resetContent: `Self` { get }
205 Reset Content
static var seeOther: `Self` { get }
303 See Other
static var serviceUnavailable: `Self` { get }
503 Service Unavailable
static var switchingProtocols: `Self` { get }
101 Switching Protocols
static var temporaryRedirect: `Self` { get }
307 Temporary Redirect
static var tooEarly: `Self` { get }
425 Too Early
static var tooManyRequests: `Self` { get }
429 Too Many Requests
static var unauthorized: `Self` { get }
401 Unauthorized
static var unavailableForLegalReasons: `Self` { get }
451 Unavailable For Legal Reasons
static var unprocessableContent: `Self` { get }
422 Unprocessable Content
static var unsupportedMediaType: `Self` { get }
415 Unsupported Media Type
static var upgradeRequired: `Self` { get }
426 Upgrade Required
static var uriTooLong: `Self` { get }
414 URI Too Long
let code: Int
The 3-digit status code.
var description: String { get }
var kind: Kind { get }
The kind of the status code.
let reasonPhrase: String
The reason phrase.
static func == (lhs: Status, rhs: Status) -> Bool
func hash(into hasher: inout Hasher)
protocol BitwiseCopyable
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.