Class: RackStep::Response

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

Instance Method Summary collapse

Instance Method Details

#body=(value) ⇒ Object

The original body= method of Rack::Response expects an array. In RackStep the user may set it as a String and we will convert it to array if necessary.



11
12
13
14
15
16
17
18
# File 'lib/response.rb', line 11

def body=(value)
  if value.is_a?(String)
    # Convert it to an array.
    value = [value]
  end

  super(value)
end

#content_typeObject

Just a helper to get the content type from the response header.



21
22
23
# File 'lib/response.rb', line 21

def content_type
  header['Content-Type']
end

#content_type=(value) ⇒ Object

Just a helper to set the content type on the response header.



26
27
28
# File 'lib/response.rb', line 26

def content_type=(value)
  header['Content-Type'] = value
end