Response

public struct Response<Value, Error: ErrorType>

Used to store all response data returned from a completed Request.

  • The URL request sent to the server.

    Declaration

    Swift

    public let request: NSURLRequest?
  • The server’s response to the URL request.

    Declaration

    Swift

    public let response: NSHTTPURLResponse?
  • The data returned by the server.

    Declaration

    Swift

    public let data: NSData?
  • The result of response serialization.

    Declaration

    Swift

    public let result: Result<Value, Error>
  • The timeline of the complete lifecycle of the Request.

    Declaration

    Swift

    public let timeline: Timeline
  • Initializes the Response instance with the specified URL request, URL response, server data and response serialization result.

    Declaration

    Swift

    public init(
            request: NSURLRequest?,
            response: NSHTTPURLResponse?,
            data: NSData?,
            result: Result<Value, Error>,
            timeline: Timeline = Timeline())

    Parameters

    request

    The URL request sent to the server.

    response

    The server’s response to the URL request.

    data

    The data returned by the server.

    result

    The result of response serialization.

    timeline

    The timeline of the complete lifecycle of the Request. Defaults to Timeline().

    Return Value

    the new Response instance.

  • The textual representation used when written to an output stream, which includes whether the result was a success or failure.

    Declaration

    Swift

    public var description: String
  • The debug textual representation used when written to an output stream, which includes the URL request, the URL response, the server data and the response serialization result.

    Declaration

    Swift

    public var debugDescription: String