HTTPRequestBuilder

public class HTTPRequestBuilder

A builder class which can be used to prepare an HTTP request to be executed by the Stitch HTTP service.

  • Undocumented

    Declaration

    Swift

    public init()
  • Sets the URL that the request will be performed against.

    Declaration

    Swift

    @discardableResult
    public func with(url: String) -> Self
  • Sets the HTTP method of the request.

    Declaration

    Swift

    @discardableResult
    public func with(method: HTTPMethod) -> Self
  • Sets the URL that will be used to capture cookies for authentication before the actual request is executed.

    Declaration

    Swift

    @discardableResult
    public func with(authURL: String) -> Self
  • Sets the headers that will be included in the request.

    Declaration

    Swift

    @discardableResult
    public func with(headers: [String : [String]]) -> Self
  • Sets the cookies that will be included in the request.

    Declaration

    Swift

    @discardableResult
    public func with(cookies: [String : String]) -> Self
  • Sets the body that will be included in the request.

    Declaration

    Swift

    @discardableResult
    public func with(body: Data?) -> Self
  • Sets whether or not the included body should be encoded as extended JSON when sent to the url in this request. Defaults to false if not set.

    Declaration

    Swift

    @discardableResult
    public func with(encodeBodyAsJSON: Bool) -> Self
  • Sets the form that will be included in the request.

    Declaration

    Swift

    @discardableResult
    public func with(form: [String : String]) -> Self
  • Sets whether or not Stitch should follow redirects while executing the request. Defaults to false if not set.

    Declaration

    Swift

    @discardableResult
    public func with(followRedirects: Bool) -> Self
  • Builds, validates, and returns the HTTPRequest.

    Declaration

    Swift

    public func build() throws -> HTTPRequest