# Get the requested URI, and check the HTTP response. Then convert to JSON
# and check for Github errors.
- fun get_and_check(uri: String): nullable Object
+ fun get_and_check(uri: String): nullable Jsonable
do
var request = new CurlHTTPRequest(uri, self)
request.user_agent = user_agent
var response = request.execute
if response isa CurlResponseSuccess then
- var obj = response.body_str.json_to_nit_object
- if obj isa HashMap[String, nullable Object] then
+ var obj = response.body_str.parse_json
+ if obj isa JsonObject then
if obj.keys.has("message") then
- print "Message from Github API: {obj["message"]}"
+ print "Message from Github API: {obj["message"] or else ""}"
print "Requested URI: {uri}"
abort
end