class Athena::Routing::Response
- Athena::Routing::Response
- Reference
- Object
Overview
Represents an HTTP
response that should be returned to the client.
Contains the content, status, and headers that should be applied to the actual HTTP::Server::Response
.
This type is used to allow the content, status, and headers to be mutated by ART::Listeners
before being returned to the client.
The #content
is written all at once to the server response's IO
.
Direct Known Subclasses
Defined in:
response.crConstructors
-
.new(status : HTTP::Status | Int32 = HTTP::Status::OK, headers : HTTP::Headers = HTTP::Headers.new, &block : IO -> Nil) : ART::StreamedResponse
DEPRECATED Use
ART::StreamedResponse.new
instead. This will be removed in Athena0.13.0
. -
.new(content : String | Nil = nil, status : HTTP::Status | Int32 = HTTP::Status::OK, headers : HTTP::Headers = HTTP::Headers.new)
Creates a new response with optional content, status, and headers arguments.
Instance Method Summary
-
#content : String
Returns the contents of this response.
-
#content=(content : String | Nil)
Sets the response content.
-
#headers : HTTP::Headers
Returns the response headers of this response.
-
#status : HTTP::Status
Returns the
HTTP::Status
of this response. -
#status=(code : HTTP::Status | Int32) : Nil
Sets the status of this response.
-
#write(output : IO) : Nil
Writes the
#content
to the provided output. - #writer=(writer : ART::Response::Writer)
Constructor Detail
DEPRECATED Use ART::StreamedResponse.new
instead. This will be removed in Athena 0.13.0
.
Creates a new response with optional content, status, and headers arguments.
Instance Method Detail
Writes the #content
to the provided output.
How the output gets written can be customized via an ART::Response::Writer
.