CLASS

HTTPURLResponseContent

Contents

public class HTTPURLResponseContent: NSObject

The contents of a URL based HTTP response.

Properties

data

public let data: Data?

The data returned by the server.

httpURLResponse

public let httpURLResponse: HTTPURLResponse?

An object that provides response metadata, such as HTTP headers and status code. If you are making an HTTP or HTTPS request, the returned object is actually an HTTPURLResponse object.

dataAsDictionary

public lazy var dataAsDictionary: [String: Any] = {
    return if let data = data, let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] {
        json
    } else {
        [:]
    }
}()

The serialization of the data as a map of [String: Any]