Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form data key of "x-amz-security-token" changes from string key to object {x: { amz: {security: { token: <value> } } } } #6293

Open
joseph-mccombs opened this issue Mar 13, 2024 · 0 comments

Comments

@joseph-mccombs
Copy link

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 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:

await fetch(url, {
                method: "POST",
                body: formData,
              });

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:

await fetch(url, {
                method: "POST",
                body: 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant