Class: WebSocket::HTTP::Response

Inherits:
Object
  • Object
show all
Includes:
Headers
Defined in:
lib/websocket/http/response.rb

Constant Summary collapse

STATUS_LINE =
/^(HTTP\/[0-9]+\.[0-9]+) ([0-9]{3}) ([\x20-\x7e]*)$/

Constants included from Headers

Headers::CR, Headers::HEADER_LINE, Headers::LF, Headers::MAX_LINE_LENGTH

Instance Attribute Summary collapse

Attributes included from Headers

#headers

Instance Method Summary collapse

Methods included from Headers

#complete?, #error?, #initialize, #parse

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code


9
10
11
# File 'lib/websocket/http/response.rb', line 9

def code
  @code
end

Instance Method Details

#[](name) ⇒ Object


11
12
13
# File 'lib/websocket/http/response.rb', line 11

def [](name)
  @headers[HTTP.normalize_header(name)]
end

#bodyObject


15
16
17
# File 'lib/websocket/http/response.rb', line 15

def body
  @buffer.pack('C*')
end