HTTPClient
public protocol HTTPClient
The contract for HTTP URL loading service. All HTTP Clients must conform to provide HTTP URL Loading services.
-
request(_:Default implementationmethod: headers: queryParameters: ) API to request a URL with query parameters. Suggested to use this API for
GET&DELETEURL requests.Default Implementation
API to request a URL with query parameters. Suggested to use this API for
GET&DELETEURL requests.Declaration
Swift
func request(_ url: URLProvider, method: HTTPMethod, headers: Headers?, queryParameters: Parameters?) -> ResponseHandlerParameters
urlURLProvidervalue to be used as theURLRequest‘sURL.String,URLandURLComponentsconform toURLProvider.methodHTTPMethodfor theURLRequest.headersHeadersvalue to be added to theURLRequest.queryParametersParameters(a.k.a.[String: String]) value to be encoded into theURLRequest.nilby default.Return Value
- A
ResponseHandlertype to which response handlers could be submitted
- A
-
request(_:Default implementationmethod: headers: httpBody: ) API to request a URL with a
Encodablebody as payload. Suggested to use this API forPOST&PUTURL requests.Default Implementation
API to request a URL with a
Encodablebody as payload. Suggested to use this API forPOST&PUTURL requests.Declaration
Swift
func request<Parameters: Encodable>(_ url: URLProvider, method: HTTPMethod, headers: Headers?, httpBody: Parameters?) -> ResponseHandlerParameters
urlURLProvidervalue to be used as theURLRequest‘sURL.methodHTTPMethodfor theURLRequest.headersHeadersvalue to be added to theURLRequest.httpBodyEncodablevalue to be encoded into theURLRequest.Return Value
- A
ResponseHandlertype to which response handlers could be submitted
- A
-
request(_:Extension method) API to request a URL with query parameters. Suggested to use this API for
GET&DELETEURL requests.Declaration
Swift
func request(_ requestWithQuery: RequestWithQuery) -> ResponseHandlerParameters
requestWithQueryThe request.
Return Value
- A
ResponseHandlertype to which response handlers could be submitted
- A
-
request(_:Extension method) API to request a URL with a
Encodablebody as payload. Suggested to use this API forPOST&PUTURL requests.Declaration
Swift
func request<T>(_ requestWithPayload: RequestWithPayload<T>) -> ResponseHandler where T : EncodableParameters
requestWithPayloadThe request.
Return Value
- A
ResponseHandlertype to which response handlers could be submitted
- A