test for passing through the error object
test error-handling for invalid json responses
remove unreachable OR branch
improve test for isJSONResponse
json property should not be set for different content types