ClientResponse
public class ClientResponse
This class describes the response sent by the remote server to an HTTP request
sent using the ClientRequest
class.
-
Undocumented
Declaration
Swift
public init()
-
Undocumented
Declaration
Swift
public private(set) var httpStatusCode: HTTPStatusCode { get }
-
HTTP Method of the incoming message.
Declaration
Swift
@available(*, deprecated, message: "This method never worked on Client Responses and was inherited incorrectly from a super class") public var method: String { get }
-
Major version of HTTP of the response
Declaration
Swift
public var httpVersionMajor: UInt16?
-
Minor version of HTTP of the response
Declaration
Swift
public var httpVersionMinor: UInt16?
-
Set of HTTP headers of the response.
Declaration
Swift
public var headers: HeadersContainer { get set }
-
The HTTP Status code, as an Int, sent in the response by the remote server.
Declaration
Swift
public internal(set) var status: Int { get }
-
The HTTP Status code, as an
HTTPStatusCode
, sent in the response by the remote server.Declaration
Swift
public internal(set) var statusCode: HTTPStatusCode { get set }
-
Read a chunk of the body of the response.
Throws
if an error occurs while reading the body.Declaration
Swift
@discardableResult public func read(into data: inout Data) throws -> Int
Parameters
into
An NSMutableData to hold the data in the response.
Return Value
the number of bytes read.
-
Read a chunk of the body and return it as a String.
Throws
if an error occurs while reading the data.Declaration
Swift
@discardableResult public func readString() throws -> String?
Return Value
an Optional string.
-
Read the whole body of the response.
Throws
if an error occurs while reading the data.Declaration
Swift
@discardableResult public func readAllData(into data: inout Data) throws -> Int
Parameters
into
An NSMutableData to hold the data in the response.
Return Value
the number of bytes read.