Skip to content

Commit

Permalink
fix: unify urlencoded body serialisation with current query serialisa…
Browse files Browse the repository at this point in the history
…tion

Body serialisation now also matches documentation.
  • Loading branch information
MaoShizhong committed Jun 29, 2024
1 parent 3317168 commit b8ec936
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ request.types = {
*/

request.serialize = {
'application/x-www-form-urlencoded': qs.stringify,
'application/x-www-form-urlencoded': (obj) => {
return qs.stringify(obj, { indices: false, strictNullHandling: true });
},
'application/json': safeStringify
};

Expand Down
4 changes: 3 additions & 1 deletion src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ exports.protocols = {
*/

exports.serialize = {
'application/x-www-form-urlencoded': qs.stringify,
'application/x-www-form-urlencoded': (obj) => {
return qs.stringify(obj, { indices: false, strictNullHandling: true });
},
'application/json': safeStringify
};

Expand Down

0 comments on commit b8ec936

Please sign in to comment.