NetworkRequest

public protocol NetworkRequest

The network request is a protocol that serves as a base protocol for requests on remote servers. The protocol is mainly used as a common base for Request and StreamRequest. You should never directly use this protocol as it hardly provides any functionality.

Protocol

  • usesSecureProtocol Default implementation

    Whether the request makes use of the secure counterpart of the protocol (e.g. “https” for HTTP requests, “wss” for WebSockets). If this option is set, it overrides the option set on the service it is scheduled against.

    Default Implementation

    By default, this is set to true. Think twice before setting this to false and allowing insecure network requests.

    Declaration

    Swift

    var usesSecureProtocol: Bool? { get }

URL Manipulation

  • url Default implementation

    The optional base URL of the API endpoint represented by this HTTP request (e.g. “api.example.com”). If this option is set, it overrides the apiUrl option set on the service it is scheduled against.

    Default Implementation

    By default, the apiUrl on the service is used.

    Declaration

    Swift

    var url: UrlConvertible? { get }
  • routes Default implementation

    The routing paths of the request.

    Default Implementation

    By default, no routing paths are used.

    Declaration

    Swift

    var routes: HttpRoute { get }
  • query Default implementation

    The query parameters to be used in the request.

    Default Implementation

    Defaults to no parameters.

    Declaration

    Swift

    var query: HttpQuery { get }
  • header Default implementation

    The header fields set when scheduling the request. These fields overwrite potential header fields defined by the HTTP service that the request is issued against.

    Default Implementation

    Defaults to no headers.

    Declaration

    Swift

    var header: HttpHeader { get }

Fine-Tuning

  • priority Default implementation

    The priority of the request.

    Default Implementation

    Defaults to .userInitiated.

    Declaration

    Swift

    var priority: RequestPriority { get }
  • timeout Default implementation

    The number of seconds to wait before a request is considered to have failed.

    Default Implementation

    Defaults to TimeInterval.infinity, i.e. no timeout is ever raised.

    Declaration

    Swift

    var timeout: TimeInterval { get }