Fix a crash When the response is not json (e.g. Facebook)
Improve the tests to detect this error in the future