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
This commit is contained in:
parent
e2e663a143
commit
8fa2c0b532
1 changed files with 3 additions and 2 deletions
|
|
@ -90,8 +90,9 @@ func newfetchOptions*(metod: HttpMethod; body: cstring;
|
||||||
headers: Headers = newHeaders()): FetchOptions =
|
headers: Headers = newHeaders()): FetchOptions =
|
||||||
## Constructor for `FetchOptions`.
|
## Constructor for `FetchOptions`.
|
||||||
result = FetchOptions(
|
result = FetchOptions(
|
||||||
body: body, mode: cstring($mode), credentials: cstring($credentials), cache: cstring($cache), referrerPolicy: cstring($referrerPolicy),
|
body: if metod notin {HttpHead, HttpGet}: body else: nil,
|
||||||
keepalive: keepalive, redirect: cstring($redirect), referrer: referrer, integrity: integrity,
|
mode: cstring($mode), credentials: cstring($credentials), cache: cstring($cache), referrerPolicy: cstring($referrerPolicy),
|
||||||
|
keepalive: keepalive, redirect: cstring($redirect), referrer: referrer, integrity: integrity, headers: headers,
|
||||||
metod: (case metod
|
metod: (case metod
|
||||||
of HttpHead: "HEAD".cstring
|
of HttpHead: "HEAD".cstring
|
||||||
of HttpGet: "GET".cstring
|
of HttpGet: "GET".cstring
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue