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 OKresponse code.Declaration
Swift
case ok
-
The
201 Createdresponse code.Declaration
Swift
case created
-
The
204 No Contentresponse code.Declaration
Swift
case noContent
-
The
400 Bad Requestresponse code.Declaration
Swift
case badRequest
-
The
401 Unauthorizedresponse code.Declaration
Swift
case unauthorized
-
The
404 Not Foundresponse code.Declaration
Swift
case notFound
-
The
409 Conflictresponse code.Declaration
Swift
case conflict
-
The
410 Goneresponse code.Declaration
Swift
case gone
-
The
422 Unprocessable Entityresponse code.Declaration
Swift
case unprocessableEntity
-
The
502 Bad Gatewayresponse 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
HTTPResponseStatusto the value represented by the givenInt.Declaration
Swift
public init(_ statusCode: Int)Parameters
statusCodeThe HTTP status code.
-
Indicates whether the receiver’s
responseCategoryis.Informational.Declaration
Swift
public var isInformational: Bool -
Indicates whether the receiver’s
responseCategoryis.Success.Declaration
Swift
public var isSuccess: Bool -
Indicates whether the receiver’s
responseCategoryis.Redirection.Declaration
Swift
public var isRedirect: Bool -
Indicates whether the receiver’s
responseCategoryis.ClientError.Declaration
Swift
public var isClientError: Bool -
Indicates whether the receiver’s
responseCategoryis.ServerError.Declaration
Swift
public var isServerError: Bool -
Indicates whether the receiver represents a
.ClientErroror.ServerError.Declaration
Swift
public var isError: Bool
View on GitHub
HTTPResponseStatus Enum Reference