Initializerasync-http-client 1.23.0AsyncHTTPClient
init(url:method:headers:body:tlsConfiguration:)
Create an HTTP Request
.
init(url: URL, method: HTTPMethod = .GET, headers: HTTPHeaders = HTTPHeaders(), body: Body? = nil, tlsConfiguration: TLSConfiguration?) throws
Parameters
- url
Remote
URL
.- method
HTTP method.
- headers
Custom HTTP headers.
- body
Request body.
- tlsConfiguration
Request TLS configuration
Throws
emptyScheme
if URL does not contain HTTP scheme.unsupportedScheme
if URL does contains unsupported HTTP scheme.emptyHost
if URL does not contains a host.missingSocketPath
if URL does not contains a socketPath as an encoded host.
Other members in extension
Type members
init(url: URL, method: HTTPMethod, headers: HTTPHeaders, body: Body?
) throws Create an HTTP
Request
.init(url: String, method: HTTPMethod, headers: HTTPHeaders, body: Body?
) throws Create HTTP request.
init(url: String, method: HTTPMethod, headers: HTTPHeaders, body: Body?, tlsConfiguration: TLSConfiguration?
) throws Create HTTP request.
Instance members
var body: Body?
Request body, defaults to no body.
var headers: HTTPHeaders
Request custom HTTP Headers, defaults to no headers.
var host: String
Remote host, resolved from
URL
.let method: HTTPMethod
Request HTTP method, defaults to
GET
.var port: Int
Resolved port.
var scheme: String
Remote HTTP scheme, resolved from
URL
.var tlsConfiguration: TLSConfiguration?
Request-specific TLS configuration, defaults to no request-specific TLS configuration.
let url: URL
Remote URL.
var useTLS: Bool
Whether request will be executed using secure socket.