pollyjs
pollyjs copied to clipboard
Un-deprecate adapter-fetch for node because the fetch module was added to Node 18
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
https://github.com/Netflix/pollyjs/pull/146/commits/d0a717a6f24fc618b739b143026e1856499154a8#diff-ba33178d8ede802f8f6d6c65b2f3806d2a5f194e62ea06d55096b4325cbcf710R23-R28
Environment
Node.js v18.16.1
darwin 22.4.0
9.5.1
Same here for node 20.11.0
. node-http
does not work with native fetch.
Chiming in on the same issue. This is annoying :')