Question
Behavior of Axios GET request bodies across browsers and servers
Kavi Nova
0 reputation · 05 May 2023, 20:49 UTC
147.1K views0
Goal
Determine how Axios handles a request body when the HTTP method is GET, given that the HTTP/1.1 specification discourages bodies on GET requests. The question is whether Axios should automatically strip the body or allow it to be sent, and how different environments behave.
Constraints
- Browsers may forward the body but many servers ignore or reject it.
- Node.js’ http module will send the body, but the server may drop it.
- There is no current standard that mandates a specific behavior for GET bodies.
Unresolved Decision
Axios currently allows a data payload on GET requests. It is unclear if this should be considered a feature or a bug, and whether a stricter compliance mode should be introduced.
Specific Questions
- In a typical browser environment, does Axios send the body of a GET request, and does the server receive it?
- When Axios runs under Node.js, does the underlying http module transmit the body, and how do servers that enforce strict HTTP semantics react?
- Should Axios provide an option to automatically strip GET bodies or enforce a stricter compliance mode, and what would be the impact on existing codebases?