Skip to content

Commit

Permalink
Use same defaults as JS for fetch options (#20783)
Browse files Browse the repository at this point in the history
* Use same defaults as JS for fetch options

* Add changelog entry
  • Loading branch information
ire4ever1190 authored Nov 9, 2022
1 parent d8d0832 commit 1826ff7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
6 changes: 3 additions & 3 deletions lib/std/jsfetch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 1826ff7

Please sign in to comment.