Response
public class Response
Contains useful response data from an HTTP request made by the Request class.
-
The HTTP status of the response.
Declaration
Swift
public let statusCode: Int? -
HTTP headers from the response.
Declaration
Swift
public let headers: [AnyHashable: Any]? -
The body of the response. Returns nil if there is no body or the body cannot be converted to a
String.Declaration
Swift
public let responseText: String? -
The body of the response. Returns nil if there is no body or if the response is not valid
Data.Declaration
Swift
public let responseData: Data? -
The response is considered successful if the returned status code is in the 2xx range.
Declaration
Swift
public let isSuccessful: Bool
-
Converts an
HTTPURLResponseto a more accessible response object.Declaration
Swift
public init(responseData: Data?, httpResponse: HTTPURLResponse?, isRedirect: Bool)Parameters
responseDataData returned from the server.
httpResponseResponse object returned from the
URLSessionrequest.isRedirectTrue if the response requires a redirect.
View on GitHub
Response Class Reference