Use same defaults as JS for fetch options (#20783)

* Use same defaults as JS for fetch options

* Add changelog entry
This commit is contained in:
Jake Leahy
2022-11-09 22:22:18 +11:00
committed by GitHub
parent d8d08324d3
commit 1826ff7d84
2 changed files with 4 additions and 4 deletions

View File

@@ -118,7 +118,7 @@
- `std/net.IpAddress` dollar `$` improved, uses a fixed capacity for the `string` result based from the `IpAddressFamily`.
- `std/jsfetch.newFetchOptions` now has default values for all parameters
[//]: # "Additions:"
- Added ISO 8601 week date utilities in `times`:

View File

@@ -84,9 +84,9 @@ proc unsafeNewFetchOptions*(metod, body, mode, credentials, cache, referrerPolic
"{method: #, body: #, mode: #, credentials: #, cache: #, referrerPolicy: #, keepalive: #, redirect: #, referrer: #, integrity: #, headers: #}".}
## .. warning:: Unsafe `newfetchOptions`.
func newfetchOptions*(metod: HttpMethod; body: cstring;
mode: FetchModes; credentials: FetchCredentials; cache: FetchCaches; referrerPolicy: FetchReferrerPolicies;
keepalive: bool; redirect = frFollow; referrer = "client".cstring; integrity = "".cstring,
func newfetchOptions*(metod = HttpGet; body: cstring = nil;
mode = fmCors; credentials = fcSameOrigin; cache = fchDefault; referrerPolicy = frpNoReferrerWhenDowngrade;
keepalive = false; redirect = frFollow; referrer = "client".cstring; integrity = "".cstring,
headers: Headers = newHeaders()): FetchOptions =
## Constructor for `FetchOptions`.
result = FetchOptions(