Class: Innate::Response

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

Overview

In order to reset the body contents we also need to reset the length set by Response#write - until I can submit a patch to Rack and the next release we just do this.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Optioned

included

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



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

def length
  @length
end

Instance Method Details

#finishObject



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

def finish
  options.headers.each{|key, value| self[key] ||= value }
  super
end

#resetObject



17
18
19
20
21
22
23
# File 'lib/innate/response.rb', line 17

def reset
  self.status = 200
  self.header.delete('Content-Type')
  body.clear
  self.length = 0
  self
end