ladjs / superagent

Ajax for Node.js and browsers (JS HTTP client). Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
https://ladjs.github.io/superagent/
MIT License
16.58k stars 1.33k forks source link

fix: unify body and query serialisation behaviour #1808

Closed MaoShizhong closed 1 month ago

MaoShizhong commented 3 months ago

Because

1591 changed things to use qs to serialise form data. However, that change set qs.stringify as the body serialisation function i.e. default options. The existing query serialisation uses qs.stringify with indices: false and strictNullHandling: true options (src/node/index.js line 679).

Existing documentation indicates that body serialisation with duplicated object keys should result in the same behaviour as the existing query serialisation. However, qs.stringify with default options results in a different outcome, as described in the issue this PR closes.

This PR

Linked issue

Closes #1798

Checklist

MaoShizhong commented 1 month ago

@titanism anything extra I might need to fix the above?

titanism commented 1 month ago

v10.1.0 released to npm, thank you @MaoShizhong

ref: https://github.com/ladjs/superagent/releases/tag/v10.1.0

p.s. our efforts to maintain this repo are supported by @forwardemail