Add one more version of `new(RestClientRef)` which accepts HttpAddress. (#57)
This commit is contained in:
parent
a30fcd4c29
commit
eee1f7ad04
|
@ -156,6 +156,26 @@ proc new*(t: typedesc[RestClientRef],
|
|||
ok(RestClientRef(session: session, address: address, agent: userAgent,
|
||||
flags: flags))
|
||||
|
||||
proc new*(t: typedesc[RestClientRef],
|
||||
address: HttpAddress,
|
||||
flags: RestClientFlags = {},
|
||||
httpFlags: HttpClientFlags = {},
|
||||
maxConnections: int = -1,
|
||||
maxRedirections: int = HttpMaxRedirections,
|
||||
connectTimeout = HttpConnectTimeout,
|
||||
headersTimeout = HttpHeadersTimeout,
|
||||
idleTimeout = HttpConnectionIdleTimeout,
|
||||
idlePeriod = HttpConnectionCheckPeriod,
|
||||
bufferSize: int = 4096,
|
||||
userAgent = PrestoIdent,
|
||||
socketFlags: set[SocketFlags] = {}
|
||||
): RestResult[RestClientRef] =
|
||||
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
|
||||
headersTimeout, bufferSize, maxConnections,
|
||||
idleTimeout, idlePeriod, socketFlags)
|
||||
ok(RestClientRef(session: session, address: address, agent: userAgent,
|
||||
flags: flags))
|
||||
|
||||
proc new*(t: typedesc[RestClientRef],
|
||||
ta: TransportAddress,
|
||||
scheme: HttpClientScheme = HttpClientScheme.NonSecure,
|
||||
|
|
Loading…
Reference in New Issue