client-nodejs icon indicating copy to clipboard operation
client-nodejs copied to clipboard

Normalization of a custom field fails with null values

Open aleksipyykkonen opened this issue 2 years ago • 0 comments

Hi! We encountered an issue with null values in custom fields, while doing Create or Update requests to API through the client.

Request body with a null value in a custom field

{ "5eadaf49cdc5869afabd486099553698a7096dd0":null}

is being "normalized" to

{"5eadaf49cdc5869afabd486099553698a7096dd0": "5eadaf49cdc5869afabd486099553698a7096dd0"}

converting the null value to a string, containing the key.

The issue seems to be in replaceCamelCaseObj function, where null value is considered to be an object, and therefore key is used as a value, instead of keyValue.

if (isHash) {
    snakeCased[key] = isObject ? key : keyValue;
} 

aleksipyykkonen avatar Oct 18 '22 09:10 aleksipyykkonen