Start a new topic

Removing empty items from a post

It seems that empty items are being removed from my JSON... is that supposed to happen?



if I send

{

"records": []

}

to a custom endpoint



I would expect to find that request.body.records.length == 0



however, records doesn't even exist anymore, the body is just {}



why? Did I miss something somewhere?

I was able to reproduce this problem by not including the required 'Content-Type: application/json' header.



Try this instead:



POST /rpc//custom/ HTTP/1.1

Host: baas.kinvey.com

Authorization: Basic a2lkMTY3NDpm***********0YjQzOWI0NDJmZjUwN2Y4NzIyNg==

Content-Type: application/json



{ "records": [] }





apparently this is only when using the API Console, which is (or I guess was) my main way of testing the various endpoints
Yes there are some known issues with the API Console as it relates to empty arrays and null data. Those issues have been reported and will be addressed in the near future. There is a bigger issue that we are planning to address which is better utilities for testing.



In the meantime, I suggest using a Postman chrome extension or one of the many commandline REST clients like curl to test your endpoints.
Login or Signup to post a comment