You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using axios post and formData for an aws call, payload changes form froma string key to a nested object.
I have these 5 keys in the formData, key, AWSAccessKeyId, x-amz-secuity-token, policy and signature with respective values. These are all added to a formData object.
When i make a post call with axios via: await axios.post(url, formData); the key x-amz-secuity-token is transformed to the following on the network request:
x: {
amz: {
secutiy: {
token: <value>
}
}
This causes the network request to fail. When i run the same request with fetch via:
The request succeeds as expected and the formData is unchanged in the payload.
To Reproduce
Run await axios.post(url, formData); with formData that has a key similar to x-amz-security-token (the dashes) and inspect the payload, the formData object should transform for the key specified into an object.
A similar call with fetch succeeds without transforming the formData:
Describe the bug
When using axios post and formData for an aws call, payload changes form froma string key to a nested object.
I have these 5 keys in the formData,
key
,AWSAccessKeyId
,x-amz-secuity-token
,policy
andsignature
with respective values. These are all added to a formData object.When i make a post call with axios via:
await axios.post(url, formData);
the keyx-amz-secuity-token
is transformed to the following on the network request:This causes the network request to fail. When i run the same request with fetch via:
The request succeeds as expected and the formData is unchanged in the payload.
To Reproduce
Run
await axios.post(url, formData);
with formData that has a key similar tox-amz-security-token
(the dashes) and inspect the payload, the formData object should transform for the key specified into an object.A similar call with fetch succeeds without transforming the formData:
Code snippet
No response
Expected behavior
I expect the formData to remain intact when performing the call instead of transforming into an object.
Axios Version
1.6.4, 1.6.7
Adapter Version
No response
Browser
Chrome
Browser Version
122
Node.js Version
18.17.0
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: