Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

formdata gets stringified #447

@simllll

Description

@simllll

Environment details

  • OS: linux
  • Node.js version: v16.10
  • npm version: 7.24.1
  • gaxios version: 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

} 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?

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.priority: p2Moderately-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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions