Un-deprecate adapter-fetch for node because the fetch module was added to Node 18
Author: tncbbthositgCreated Nov 10, 2023Updated Jun 1, 2024
Description
At some point, the assumption was that the fetch global was a polyfill provided by node-fetch and that the node http module would be the lowest level underlying mechanism for making http requests.
This changed as of Node 18 so the deprecation warning is no longer valid:
[Polly] [adapter:fetch] Using the fetch adapter in Node has been deprecated. Please use the node-http adapter instead.
Shareable Source
import * as FetchAdapter from '@pollyjs/adapter-fetch';
Polly.register(FetchAdapter as any);Error Message & Stack Trace
[Polly] [adapter:fetch] Using the fetch adapter in Node has been deprecated. Please use the node-http adapter instead.Config
polly = new Polly('Recording Name', {
adapters: ['fetch'],
persister: 'fs',
});Dependencies
{
"@pollyjs/adapter-fetch": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6",
}Relevant Links
https://github.com/Netflix/pollyjs/blob/master/CHANGELOG.md#bug-fixes-32
https://github.com/Netflix/pollyjs/pull/146
Environment
Node.js v18.16.1
darwin 22.4.0
9.5.1Source: Netflix/pollyjs