HTTPRequest
public protocol HTTPRequest
A protocol for defining a HTTP request.
-
Declaration
Swift
associatedtype ResponseObject
-
Declaration
Swift
associatedtype ErrorObject : Error
-
The base URL.
Declaration
Swift
var baseURL: URL { get }
-
The URL path.
Declaration
Swift
var path: String { get }
-
method
Default implementationThe HTTP method used in the request.
Default Implementation
Declaration
Swift
var method: HTTPMethod { get }
-
queryItems
Default implementationAn array of query items to be appended to the URL path.
Default Implementation
Declaration
Swift
var queryItems: [URLQueryItem]? { get }
-
headers
Default implementationDictionary
of headers.Default Implementation
Declaration
Swift
var headers: [String : String]? { get }
-
timeout
Default implementationA
TimeInterval
of when the request should timeout.Default Implementation
Declaration
Swift
var timeout: TimeInterval { get }
-
A
Bool
to indicate whether the request is authenticated or not.Declaration
Swift
var isAuthenticated: Bool { get }
-
HTTP body of the request.
Declaration
Swift
var body: Data? { get set }
-
Processes the response.
Declaration
Swift
func process(data: Data, response: URLResponse) throws -> ResponseObject
Return Value
The response object