Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sure if 401 is the only code that gives nonparseable body? [lib/watson/remote.rb] #85

Open
nhmood opened this issue Nov 21, 2013 · 0 comments

Comments

@nhmood
Copy link
Owner

nhmood commented Nov 21, 2013

filename : lib/watson/remote.rb
line # : 109
tag : fix
md5 : b547385b20a5543b644943e810e1af76

            # [fix] - Not sure if 401 is the only code that gives nonparseable body? 
            # Figure out what other response codes are bad news for JSON.parse
            _json = _resp.code == "401" ? Hash.new :  JSON.parse(_resp.body)
            debug_print "JSON: \n #{ _json }\n"

            # [review] - Returning hash of json + response the right thing to do?
            # return {:json => _json, :resp => _resp}
            return _json, _resp 
        end
    end
    end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant