Replace deprecated .data property with .body for compatibility with node-fetch@3.x #677
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Environment details:
OS: Windows 10
Node.js version: v22.12.0
npm version: v10.9.0
gaxios version: v6.7.1
Steps to reproduce
googleapis
or another library that depends ongaxios
and usesnode-fetch@3.x
:Description
The _defaultAdapter method in gaxios passes .data as a property of the opts object to node-fetch. With node-fetch@3.x, .data is no longer a valid property and should be replaced with .body. This results in the following deprecation warning:
Suggested Fix
Update _defaultAdapter to translate .data into .body before making the request. Example:
This change ensures compatibility with node-fetch@3.x and removes the deprecation warning.
Expected Behavior:
gaxios should internally convert .data to .body before passing the options to node-fetch. This ensures compatibility with node-fetch@3.x and eliminates the deprecation warning.
The text was updated successfully, but these errors were encountered: