Halite::Response
Constructors
new(uri : URI, status_code : Int32, body : String | Nil = nil, headers = HTTP::Headers.new, status_message = nil, body_io : IO | Nil = nil, version = "HTTP/1.1", history = [] of Halite::Response)
Sourcenew(uri : URI, conn : HTTP::Client::Response, history : Array(Halite::Response) = [] of Halite::Response)
SourceInstance methods
body(*args, **options)
Sourcebody(*args, **options, &)
Sourcebody_io(*args, **options)
Sourcebody_io(*args, **options, &)
Sourcecharset(*args, **options)
Sourcecharset(*args, **options, &)
Sourceconn
Sourcecontent_type(*args, **options)
Sourcecontent_type(*args, **options, &)
Sourceheaders(*args, **options)
Sourceheaders(*args, **options, &)
Sourcehistory
Sourceinspect
Returns an unambiguous and information-rich string representation of this object, typically intended for developers.
This method should usually not be overridden. It delegates to
#inspect(IO) which can be overridden for custom implementations.
Also see #to_s.
raise_for_status
Raise Halite::ClientError/Halite::ServerError if one occurred.
4XXraise anHalite::ClientErrorexception5XXraise anHalite::ServerErrorexception- return
nilwith other status code
Halite.get("https://httpbin.org/status/404").raise_for_status
# => Unhandled exception: 404 not found error with url: https://httpbin.org/status/404 (Halite::ClientError)
Halite.get("https://httpbin.org/status/500", params: {"foo" => "bar"}).raise_for_status
# => Unhandled exception: 500 internal server error error with url: https://httpbin.org/status/500?foo=bar (Halite::ServerError)
Halite.get("https://httpbin.org/status/301").raise_for_status
# => nil
rate_limit
Sourcestatus_code(*args, **options)
Sourcestatus_code(*args, **options, &)
Sourcestatus_message(*args, **options)
Sourcestatus_message(*args, **options, &)
Sourcesuccess?(*args, **options)
Sourcesuccess?(*args, **options, &)
Sourceto_s(io)
Sourceuri
Sourceversion(*args, **options)
Sourceversion(*args, **options, &)
Source