GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Symbol keys are not preserved when data is being passed to transformRequest · Issue #6392 · axios/axios

Symbol keys are not preserved when data is being passed to transformRequest #6392

New issue
Copy link
New issue
Copy link
Closed
#10812
Closed
Symbol keys are not preserved when data is being passed to transformRequest#6392
#10812
Copy link
Assignees
jasonsaayman
Labels
issue::bugThis issue is related to a bug that requires fixing

Description

@legowerewolf
legowerewolf
opened on May 14, 2024
Issue body actions

Describe the bug

In the app I work on, when I make a request with a payload, I want that request to be transformed almost all of the time. Most of this transformation involves transforming keys in objects from pascalCase to snake_case (and back again when the request resolves). I think this is a stupid decision, but I didn't make it and I can't correct it myself.

In order to handle that transformation, we use the transformRequest option when we construct a customized global client object.

I intended to add a Symbol key to the payload object as a way to signal "don't transform this or its descendants" when it sees that key, but the problem is that by the time the transformer function gets the payload, that key has already been stripped. I think this is a bug.

To Reproduce

https://codesandbox.io/p/sandbox/goofy-boyd-qwmxw5

Code snippet

import axios from "axios";

const client = axios.create({
  transformRequest(data) {
    console.log("transformRequest", data);
    return data;
  },
});

const symbolKey = Symbol("example");

console.log(`Axios version: ${axios.VERSION}`);

(async () => {
  const payload = {
    [symbolKey]: "value",
    stringKey: "value",
  };

  console.log("payload as submitted", payload);

  const { data } = await client.post("https://httpbin.org/post", payload);

  console.log(data);
})();

Expected behavior

I expect to see the key [Symbol('example')] in both the "payload as submitted" and "transformRequest" log lines.

Axios Version

1.6.8

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

No response

Additional context/Screenshots

No response

Activity

  1. jasonsaayman
    self-assigned this
    on Aug 24, 2025
  2. jasonsaayman
    added
    issue::bugThis issue is related to a bug that requires fixing
    on Mar 29, 2026
  3. jasonsaayman
    closed this as completedin #10812on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jasonsaayman
    jasonsaayman

Labels

issue::bugThis issue is related to a bug that requires fixing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.