This repository was archived by the owner on Jan 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
This repository was archived by the owner on Jan 3, 2026. It is now read-only.
formdata gets stringified #447
Copy link
Copy link
Closed
Labels
🚨This issue needs some love.This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- OS: linux
- Node.js version: v16.10
- npm version: 7.24.1
gaxiosversion: 4.3.2
Steps to reproduce
send a form dat areuqest
const formData = new FormData();
formData.append('test', 123);
gaxios.request({method: POST, data: formData;})The request is stringiefied because of this line here
Line 247 in cc3dd89
| } else if (typeof opts.data === 'object') { |
formdata is typeof object.
a possible fix will be to check if object is a formdata first and in this case don't touch it?
e.g.
else if (typeof FormData !== 'undefined' && opts.data instanceof FormData) {
// remove content-type header...
} else if (typeof opts.data === 'object') { ...
altenative would be to allow skipping the whole transformation step in the validate step.. e.g. via flag?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.