Closed pikaciu22x closed 2 years ago
for anyone like me, answering my own question:
maybe i'm doing something wrong?
yes.
I was missing json: true
in the options. So the request should look like this:
await needle(
'post',
'http://localhost:3333/receiver',
{
acl: [
{ prop1: 'test', arrayProp: ['a', 'b'] },
{ prop1: 'test2', arrayProp: ['c', 'd'] },
],
},
{ headers: { 'tes-test': 'test' }, json: true }
);
Hey team,
I stumbled upon a strange body serialization error. When body includes an array, internal array properties get merged together. The issue can be reproduced with the following snippet:
output:
WRONG BODY {"acl":[{"prop1":["test","test2"],"arrayProp":["a","b","c","d"]}]}
nodejs version: 14 needle version: 3.0.0 ( same with 2.*.*)
maybe i'm doing something wrong?