improvements for httpcore (#12228)
* improvements for httpcore * further improvements, now stable API but needs extensions later on
This commit is contained in:
parent
6e681b546f
commit
b865c2a54b
4 changed files with 46 additions and 44 deletions
|
|
@ -847,7 +847,7 @@ proc newConnection(client: HttpClient | AsyncHttpClient,
|
|||
|
||||
proc override(fallback, override: HttpHeaders): HttpHeaders =
|
||||
# Right-biased map union for `HttpHeaders`
|
||||
if override.isNil:
|
||||
if override.isEmpty:
|
||||
return fallback
|
||||
|
||||
result = newHttpHeaders()
|
||||
|
|
@ -858,7 +858,7 @@ proc override(fallback, override: HttpHeaders): HttpHeaders =
|
|||
|
||||
proc requestAux(client: HttpClient | AsyncHttpClient, url: string,
|
||||
httpMethod: string, body = "",
|
||||
headers: HttpHeaders = nil): Future[Response | AsyncResponse]
|
||||
headers = EmptyHttpHeaders): Future[Response | AsyncResponse]
|
||||
{.multisync.} =
|
||||
# Helper that actually makes the request. Does not handle redirects.
|
||||
let requestUrl = parseUri(url)
|
||||
|
|
@ -892,7 +892,7 @@ proc requestAux(client: HttpClient | AsyncHttpClient, url: string,
|
|||
|
||||
proc request*(client: HttpClient | AsyncHttpClient, url: string,
|
||||
httpMethod: string, body = "",
|
||||
headers: HttpHeaders = nil): Future[Response | AsyncResponse]
|
||||
headers = EmptyHttpHeaders): Future[Response | AsyncResponse]
|
||||
{.multisync.} =
|
||||
## Connects to the hostname specified by the URL and performs a request
|
||||
## using the custom method string specified by ``httpMethod``.
|
||||
|
|
@ -917,7 +917,7 @@ proc request*(client: HttpClient | AsyncHttpClient, url: string,
|
|||
|
||||
proc request*(client: HttpClient | AsyncHttpClient, url: string,
|
||||
httpMethod = HttpGet, body = "",
|
||||
headers: HttpHeaders = nil): Future[Response | AsyncResponse]
|
||||
headers = EmptyHttpHeaders): Future[Response | AsyncResponse]
|
||||
{.multisync.} =
|
||||
## Connects to the hostname specified by the URL and performs a request
|
||||
## using the method specified.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue