Check for objects with a truthy clause to avoid nulls, fixes #16158

The fix for #16158 does not appear to be correct. Please accept my updated fix.

The previous fix tests 'object' for thruthyness and the typeof 'result'. Presumably 'result' should be tested for truthyness instead.

Currenly I get error "Cannot use 'in' operator to search for 'id' in null". This happens because the REST server responds to a PUT with status 202 and the response header fields but no response data. This is correct behaviour according to RFC2616. It is also desirable for efficiency - I don't want the REST server sending back the same data I just sent it every time. null is always  passed to Cache.put because 'object' is always true and typeof is always an object. 

I have tested my change and it fixes the bug.

Thanks
Allen