class Cossack::Response

Overview

Represents HTTP response.

response = Cossack::Response.new(204, {"Content-Length" => "20"}, "Saluton Esperantujo!")

response.status                    # => 204
response.headers["Content-Length"] # => "20"
response.body                      # => "Saluton Esperantujo!"

response.success?      # => true
response.redirection?  # => false
response.client_error? # => false
response.server_error? # => false

Defined in:

cossack/response.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(status : Int32, headers : HTTP::Headers, body : String) #

[View source]
def self.new(status : Int32, headers : Hash(String, String), body : String) #

[View source]
def self.new(status : Int32, body : String) #

[View source]

Instance Method Detail

def body : String #

[View source]
def client_error? #

Is this is a 4xx response?


[View source]
def headers : HTTP::Headers #

[View source]
def redirection? #

Is this a 3xx redirect?


[View source]
def server_error? #

Is this a 5xx response?


[View source]
def status : Int32 #

[View source]
def success? #

Is this a 2xx response?


[View source]