class

Marten::HTTP::Response

Inherits Reference / Object

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.

Constants

DEFAULT_CONTENT_TYPE = "text/html"

Constructors

new(content : String = "", content_type : String = DEFAULT_CONTENT_TYPE, status : Int32 = 200)
Source

Instance methods

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

Allows to set a specific header.

Source
content

Returns the content associated with the HTTP response.

Source
content=(content : String)

Allows to overridde the response's content.

Source
content_type

Returns the content type associated with the HTTP response.

Source
content_type=(content_type : String)

Allows to override the content type associated with the HTTP response.

Source
cookies

Returns the cookies associated with the HTTP response.

Source
headers

Returns the headers associated with the HTTP response.

Source
status

Returns the status code of the HTTP response.

Source
status=(status : Int32)

Allows to override the status code of the HTTP response.

Source

Nested types