Returning an error if the statusCode is not 200 or 304 and returning an empty object when res from the API is null.