axios icon indicating copy to clipboard operation
axios copied to clipboard

Request for reopen #1727 Default params serialisation behaviour incompatible with recent Tomcat versions.

Open tfactor2 opened this issue 1 year ago • 0 comments

Describe the bug

Request for reopening the #1727 Default params serialisation behaviour incompatible with recent Tomcat versions..

https://github.com/axios/axios/issues/1727#issuecomment-2244795901:

It's unclear why it shouldn't be a default behavior - why not use standard encoding (RFC3986 / RFC1738 as qa does) as
expected without the need for doing workarounds? The problem is that one doesn't know in advance that Axios is working in such a way that might lead to unexpected bugs.

Original description

Summary Given the default params serialisation behaviour, axios out-of-the-box may fail to work with recent Tomcat versions out- of-the-box.

The problem is the way params are serialised in the absence of a custom params serialiser configuration. The code is using the built-in encodeURIComponent function (good), but then proceeds to deliberately de-encode some characters. In particular, it de-encodes [ and ] back to raw (problem).

This is a problem with Tomcat because recent versions (e.g. 8.5.31+) have started being more pedantic about URI syntax, and by default will reject requests that contain [ or ] in the query portion.

I appreciate the motive of making the URLs built by axios more human readable, and not percent-encoding characters if you can get away with it. But blatant and wilful violation of RFC 3986, even if common practice for historical reasons, is a problem with servers that are adopting strict-by-default behaviour.

Context axios version: v0.18.0 Tomcat 8.5.32

reproduced on Axios 0.27.2.

To Reproduce

No response

Code snippet

No response

Expected behavior

No response

Axios Version

0.27.2

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

tfactor2 avatar Jul 23 '24 10:07 tfactor2