Conversation
…verifying with @adobe/fetch
🎉 Sizewatcher congratulates on the size improvement 📉:
|
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
+ Coverage 98.87% 98.90% +0.02%
==========================================
Files 1 1
Lines 89 91 +2
==========================================
+ Hits 88 90 +2
Misses 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
| You can disable all retry behavior by setting `retryOptions` to `false`. | ||
|
|
||
| ```js | ||
| const {fetch: adobeFetch, AbortController} = require('@adobe/fetch'); |
There was a problem hiding this comment.
what is the difference between adobe/fetch's abort controller and ours?
|
|
||
| try { | ||
| const response = await fetch(url, options); | ||
| const fetchFn = options.fetch || fetch; |
There was a problem hiding this comment.
this recursively invokes wrappedFetch(); so i would prefer for you to set the fetchFn once if possible. (somehow globally maybe).
Maybe there is a way to declare on import which fetch to use?
In case the options may get wiped away between retries (maybe this is too unrealistic)
| "rewire": "^5.0.0", | ||
| "semantic-release": "^17.4.7" | ||
| "rewire": "^6.0.0", | ||
| "semantic-release": "^20.0.2" |
There was a problem hiding this comment.
typically we will update major versions of dev dependencies in follow-up PRs in case they require additional changes. For instance sometimes semantic-release updates require nodejs verion increases and we won't notice that until we actually try to release, (happened before, had to update to use nodejs 16: https://github.com/adobe/node-fetch-retry/blob/master/.github/workflows/node.js.yml#L47)
There was a problem hiding this comment.
ah yep, nodejs18 is required for v20+: https://github.com/semantic-release/semantic-release/releases/tag/v20.0.0
| }); | ||
| } | ||
|
|
||
| describe('test fetch retry', () => testFetchRetry({})); |
There was a problem hiding this comment.
| describe('test fetch retry', () => testFetchRetry({})); | |
| describe('test fetch retry with default node-fetch', () => testFetchRetry({})); |
| }); | ||
| } | ||
|
|
||
| describe('test fetch retry on http errors (throw exceptions)', () => { |
There was a problem hiding this comment.
| describe('test fetch retry on http errors (throw exceptions)', () => { | |
| describe('test fetch retry on http errors (throw exceptions) with default node-fetch', () => { |
| .get(FAKE_PATH) | ||
| .reply(200, { ok: true }); | ||
| const response = await fetch(`${FAKE_BASE_URL}${FAKE_PATH}`, { method: 'GET' }); | ||
| const response = await fetch(`${FAKE_BASE_URL}${FAKE_PATH}`, { method: 'GET', ...options }); |
There was a problem hiding this comment.
super nitpick test case i just thought of, add a test without passing ,...options just to make sure it works as before. (I know we default options to {}:
Line 200 in 930a3e6
Description
Adding support for plugging the fetch implementation and verifying with @adobe/fetch
Fixes # (issue)
Types of changes
Checklist: