Connect express httpClient never throws an error

Hi,

I’m using this code for various api calls and no matter what I do to create an error, the error parameter is always null and the actual error can be found in result.body.

I’ve tried things like querying non existing endpoints. Updating issues with invalid data. Updating non existing projects.

Also sometimes the error value in the result.body returns as different type.
JSON as an object
JSON as a string
HTML as a string

Where is the consistency? Am I simply doing something wrong or is the api shot to pieces?

This applies to put, post and delete requests which I am using, not just get which is in this example.

httpClient.get(
    {
        headers: {
            Accept: 'application/json',
            'Content-Type': 'application/json'
        },
        ...options
    },
    (error, result) => {
        if (error) {
            console.error(error);
        } else {
            console.log(result.body);
        }
    }
);