Response

public class Response<RequestType, ServiceType>: Publisher
where RequestType: Request, ServiceType: HttpService

An instance of the response class is returned whenever a Request is scheduled. The response is a ConnectablePublisher with the request’s result type as output. In the future, the set of available properties and methods on an instance of the response may be extended.

As there is only a single response no matter the number of subscribers, the response is represented as a class (i.e. it is a shared publisher). Note that the actual scheduling of the request is performed upon the first subscription. Subscribers that subscribe at a later point in time receive the result as soon as it is available and do not send the request again.

Lastly, the class cannot be initialized by the user but is only returned by Squid upon scheduling a request.

Types

  • Declaration

    Swift

    public typealias Output = RequestType.Result
  • Declaration

    Swift

    public typealias Failure = ServiceType.RequestError

Computed Properties

  • Returns a publisher for the response’s header. It can be subscribed either to the header, to the response object itself, or to both in order to send the request.

    Declaration

    Swift

    public var header: AnyPublisher<[String : String], ServiceType.RequestError> { get }

Publisher