Class: Helmet::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/helmet/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Response

Returns a new instance of Response.



16
17
18
19
20
21
# File 'lib/helmet/response.rb', line 16

def initialize(env)
  @env      = env
  @status   = 200 # Default OK!
  @header   = {}
  @body     = ''
end

Instance Attribute Details

#bodyObject

HTTP response body



14
15
16
# File 'lib/helmet/response.rb', line 14

def body
  @body
end

#envObject (readonly)

Request environment



5
6
7
# File 'lib/helmet/response.rb', line 5

def env
  @env
end

#headerObject

HTTP response header



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

def header
  @header
end

#statusObject

HTTP response status



8
9
10
# File 'lib/helmet/response.rb', line 8

def status
  @status
end

Instance Method Details

#format_responseArray

Returns HTTP response tuple [status, header, body].

Returns:

  • (Array)

    HTTP response tuple [status, header, body]



24
25
26
# File 'lib/helmet/response.rb', line 24

def format_response
  [@status, @header, @body]
end