HTTPClient

public protocol HTTPClient

An HTTPClient is responsible sending requests.

  • Performs an HTTP request. The returned must fail if and only if no response from the remote could be received. The implementation is free to chose how to handle 3xx statuses.

    Declaration

    Swift

    func perform(request: HTTPRequest) -> Promise<HTTPDataResponse>

    Parameters

    request

    The request to send.

    Return Value

    A Promise to the response.

  • Performs an HTTP request by streaming its body present in the fileUrl of the request. The implementation is responsible for calling the progress handler of the promise. The returned must fail if and only if no response from the remote could be received. The implementation is free to chose how to handle 3xx statuses.

    Declaration

    Swift

    func upload(request: HTTPRequest) -> ProgressablePromise<HTTPDataResponse>

    Parameters

    request

    The request to send.

    Return Value

    A Promise to the response.