HTTPResponseStatus
public enum HTTPResponseStatus
Meaningful values for some of the common HTTP response codes.
Note that not every HTTP code is represented here; those that aren’t
can be stored in the .Other
case.
-
The
200 OK
response code.Declaration
Swift
case ok
-
The
201 Created
response code.Declaration
Swift
case created
-
The
204 No Content
response code.Declaration
Swift
case noContent
-
The
400 Bad Request
response code.Declaration
Swift
case badRequest
-
The
401 Unauthorized
response code.Declaration
Swift
case unauthorized
-
The
404 Not Found
response code.Declaration
Swift
case notFound
-
The
409 Conflict
response code.Declaration
Swift
case conflict
-
The
410 Gone
response code.Declaration
Swift
case gone
-
The
422 Unprocessable Entity
response code.Declaration
Swift
case unprocessableEntity
-
The
502 Bad Gateway
response code.Declaration
Swift
case badGateway
-
Represents HTTP response codes not covered by the other cases.
Declaration
Swift
case other(Int)
-
The numeric HTTP status code.
Declaration
Swift
public var statusCode: Int
-
Initializes an
HTTPResponseStatus
to the value represented by the givenInt
.Declaration
Swift
public init(_ statusCode: Int)
Parameters
statusCode
The HTTP status code.
-
Indicates whether the receiver’s
responseCategory
is.Informational
.Declaration
Swift
public var isInformational: Bool
-
Indicates whether the receiver’s
responseCategory
is.Success
.Declaration
Swift
public var isSuccess: Bool
-
Indicates whether the receiver’s
responseCategory
is.Redirection
.Declaration
Swift
public var isRedirect: Bool
-
Indicates whether the receiver’s
responseCategory
is.ClientError
.Declaration
Swift
public var isClientError: Bool
-
Indicates whether the receiver’s
responseCategory
is.ServerError
.Declaration
Swift
public var isServerError: Bool
-
Indicates whether the receiver represents a
.ClientError
or.ServerError
.Declaration
Swift
public var isError: Bool