api icon indicating copy to clipboard operation
api copied to clipboard

Empty arrays are removed from the request

Open mjsarfatti opened this issue 5 years ago • 1 comments

If I send an object with a property that is an empty array, this property gets removed from the request and not sent to the server.

This is unexpected and breaks a functionality where you would send an empty array to, for example, reset some property on the server.

Sending an empty string, empty object, or null value seems to work instead.

For a reproduction you can see: https://codesandbox.io/s/axios-empty-array-bug-w4yhd?file=/src/index.js

mjsarfatti avatar May 13 '20 19:05 mjsarfatti

It's actually an open PR here: https://github.com/sindresorhus/query-string/pull/238 🤦‍♂️

mjsarfatti avatar May 13 '20 20:05 mjsarfatti