class

HTTP::Server::Response

Inherits IO / Reference / Object

The response to configure and write to in an HTTP::Server handler.

The response status and headers must be configured before writing the response body. Once response output is written, changing the status and headers properties has no effect.

The HTTP::Server::Response is a write-only IO, so all IO methods are available in it.

A response can be upgraded with the upgrade method. Once invoked, headers are written and the connection IO (a socket) is yielded to the given block. This is useful to implement protocol upgrades, such as websockets.

Instance methods

cell_stream
Source
cell_stream=(value : Forest::Cell::Stream)
Source
data_padding_data
Source
data_padding_data=(value : Bytes)
Source
data_padding_length
Source
data_padding_length=(value : UInt8)
Source
end_stream?(written_size : Int64) : Bool
Source
headers_padding_data
Source
headers_padding_data=(value : Bytes)
Source
headers_padding_length
Source
headers_padding_length=(value : UInt8)
Source
stream_identifier
Source
stream_identifier=(value : Int32)
Source
unbuffered_write_chunked_end_stream
Source
upgrade

Upgrades this response, writing headers and yielding the connection IO (a socket) to the given block. This is useful to implement protocol upgrades, such as websockets.

Source
write(slice : Bytes) : Nil

See IO#write(slice).

Source
write_http2_headers
Source
written=(value : Bool)
Source
written?
Source