Skip to content

Commit 5519f20

Browse files
authored
Merge pull request #190 from heroku/req-mode
Add support for Request.mode
2 parents ed82a04 + e1288d8 commit 5519f20

File tree

9 files changed

+251
-121
lines changed

9 files changed

+251
-121
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "5"
3+
- "8"
44
script:
55
- npm run lint
66
- npm test

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ export default connect.defaults({
466466
headers: mapping.headers,
467467
credentials: mapping.credentials,
468468
redirect: mapping.redirect,
469+
mode: mapping.mode,
469470
body: mapping.body
470471
}
471472

docs/api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Instead, it *returns* a new, connected component class, for you to use.
1717
- `credentials` *(String)*: Policy for credential to include with request. One of `omit`, `same-origin`, `include`. See [`Request.credentials`](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials) for details. Defaults to `same-origin`.
1818
- `body`: Any body that you want to add to your request; however, it must be replayable (i.e. not a one time use stream). Note that a request using the `GET` or `HEAD` method cannot have a body.
1919
- `redirect` *(String)*: The redirect mode to use: `follow`, `error`, or `manual`. See [`Request.redirect`](https://developer.mozilla.org/en-US/docs/Web/API/Request/redirect) for details. Defaults to `follow`.
20+
- `mode` *(String)*: Determines if cross-origin requests lead to valid responses, and which properties of the response are readable: `cors`, `no-cors`, `same-origin`, or `navigate`. See [`Request.mode`](https://developer.mozilla.org/en-US/docs/Web/API/Request/mode) for details. Defaults to `cors`.
2021
- `refreshInterval` *(Integer)*: Interval in milliseconds to poll for new data from the URL. Defaults to `0`, which disables it.
2122
- `refreshing` *(Boolean | Function)*: If true, the request is treated as a refresh. This is generally only used when overwriting an existing `PromiseState` and it is desired that the existing `value` not be cleared or changing into the `pending` state while the request is in flight. If no previous request was fulfilled, both `pending` and `refreshing` will be set. If `refreshing` is a function — `refreshing: value -> value` — then before the new request starts the value of the existing mapping will be replaced by the return value of this function, which is called with the existing value as its sole argument. This is useful to support optimistic updates with eg. `refreshing: value => ({...value, ...body})`.
2223
- `force` *(Boolean)*: Forces the data to be always fetched when new props are received. Takes precedence over `comparison`.
@@ -94,6 +95,7 @@ const c = b.defaults({ refreshInterval: 10000 })
9495
- `credentials`
9596
- `body`
9697
- `redirect`
98+
- `mode`
9799
- `refreshing`
98100
- `refreshInterval`
99101
- `force`

0 commit comments

Comments
 (0)