mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-10 15:04:59 +00:00
Pass headers and body correctly to FetchOptions (#19884) [backport]
* Pass headers to FetchOptions
Don't pass body if method is HttpGet or HttpHead
* Syntax fixes
* Restart CI
(cherry picked from commit 8fa2c0b532)
This commit is contained in:
@@ -90,8 +90,9 @@ func newfetchOptions*(metod: HttpMethod; body: cstring;
|
||||
keepalive: bool; redirect = frFollow; referrer = "client".cstring; integrity = "".cstring): FetchOptions =
|
||||
## Constructor for `FetchOptions`.
|
||||
result = FetchOptions(
|
||||
body: body, mode: $mode, credentials: $credentials, cache: $cache, referrerPolicy: $referrerPolicy,
|
||||
keepalive: keepalive, redirect: $redirect, referrer: referrer, integrity: integrity,
|
||||
body: if metod notin {HttpHead, HttpGet}: body else: nil,
|
||||
mode: cstring($mode), credentials: cstring($credentials), cache: cstring($cache), referrerPolicy: cstring($referrerPolicy),
|
||||
keepalive: keepalive, redirect: cstring($redirect), referrer: referrer, integrity: integrity,
|
||||
metod: (case metod
|
||||
of HttpHead: "HEAD".cstring
|
||||
of HttpGet: "GET".cstring
|
||||
|
||||
Reference in New Issue
Block a user