class Marten::HTTP::Response

Overview

Represents an HTTP response.

This class allows to manipulate HTTP responses. These objects are associated with a specific HTTP response status, and they can define an associated content (and content type) as well as additional headers.

Direct Known Subclasses

Defined in:

marten/http/response.cr
marten/http/response/bad_request.cr
marten/http/response/forbidden.cr
marten/http/response/found.cr
marten/http/response/gone.cr
marten/http/response/internal_server_error.cr
marten/http/response/method_not_allowed.cr
marten/http/response/moved_permanently.cr
marten/http/response/not_found.cr
marten/http/response/see_other.cr
marten/http/response/streaming.cr

Constant Summary

DEFAULT_CONTENT_TYPE = "text/html"

Constructors

Instance Method Summary

Constructor Detail

def self.new(content : String = "", content_type : String = DEFAULT_CONTENT_TYPE, status : Int32 = 200) #

[View source]

Instance Method Detail

def []=(header : String | Symbol, value) #

Allows to set a specific header.


[View source]
def content : String #

Returns the content associated with the HTTP response.


[View source]
def content=(content : String) #

Allows to overridde the response's content.


[View source]
def content_type : String #

Returns the content type associated with the HTTP response.


[View source]
def cookies : Marten::HTTP::Cookies #

Returns the cookies associated with the HTTP response.


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

Returns the headers associated with the HTTP response.


[View source]
def status : Int32 #

Returns the status code of the HTTP response.


[View source]