Class: Stenohttp2::Server::StreamHandler::Response
- Inherits:
-
Object
- Object
- Stenohttp2::Server::StreamHandler::Response
- Defined in:
- lib/stenohttp2/server/stream_handler.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
We need this to be writable :reek:Attribute.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(stream) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(stream) ⇒ Response
Returns a new instance of Response.
39 40 41 42 |
# File 'lib/stenohttp2/server/stream_handler.rb', line 39 def initialize(stream) @content = File.read(File.join('public', 'index.html')) @stream = stream end |
Instance Attribute Details
#content ⇒ Object
We need this to be writable :reek:Attribute
45 46 47 |
# File 'lib/stenohttp2/server/stream_handler.rb', line 45 def content @content end |
Instance Method Details
#build ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/stenohttp2/server/stream_handler.rb', line 47 def build stream.headers( { ':status' => '200', 'content-length' => content.bytesize.to_s, 'content-type' => 'text/html' }, end_stream: false ) end |