Handling non-json responses from the api