var header: HeaderMap is noinit
# OAuth token
+ #
+ # Use an empty string to disable authentication and connect
+ # anonymously (thus less capabilities and more rate limits)
var auth: String
# User agent (is used by github to contact devs in case of problems)
init do
header = new HeaderMap
- header["Authorization"] = "token {auth}"
+ if auth != "" then header["Authorization"] = "token {auth}"
end
# Get the requested URI, and check the HTTP response. Then convert to JSON
if obj isa JsonObject then
if obj.keys.has("message") then
var title = "GithubAPIError"
- var msg = obj["message"].to_s
+ var msg = obj["message"].as(not null).to_s
var err = new GithubError(msg, title)
err.json["requested_uri"] = uri
err.json["status_code"] = response.status_code