W3cubDocs

/Crystal

class HTTP::Client::Response

Defined in:

http/client/response.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(status : HTTP::Status, body : String? = nil, headers : Headers = Headers.new, status_message = nil, version = "HTTP/1.1", body_io = nil)Source

def self.new(status_code : Int32, body : String? = nil, headers : Headers = Headers.new, status_message = nil, version = "HTTP/1.1", body_io = nil)Source

Class Method Detail

def self.from_io(io, ignore_body = false, decompress = true)Source

def self.from_io(io, ignore_body = false, decompress = true, &)Source

def self.from_io?(io, ignore_body = false, decompress = true)Source

Parses an HTTP::Client::Response from the given IO. Might return nil if there's no data in the IO, which probably means that the connection was closed.

def self.from_io?(io, ignore_body = false, decompress = true, &)Source

Parses an HTTP::Client::Response from the given IO and yields it to the block. Might yield nil if there's no data in the IO, which probably means that the connection was closed.

def self.mandatory_body?(status : HTTP::Status) : BoolSource

def self.supports_chunked?(version) : BoolSource

Instance Method Detail

def bodySource

def body? : String?Source

def body_io : IOSource

def body_io? : IO?Source

def charset : String?Source

def content_type : String?Source

def cookiesSource

Returns a convenience wrapper around querying and setting cookie related headers, see HTTP::Cookies.

def headers : HeadersSource

def keep_alive?Source

def mime_type : MIME::MediaType?Source

def status : HTTP::StatusSource

def status_codeSource

Convenience method to retrieve the HTTP status code.

def status_message : String?Source

def success?Source

Returns true if the response status code is between 200 and 299.

def to_io(io)Source

def version : StringSource

© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/HTTP/Client/Response.html