Class | Rack::MockResponse |
In: |
lib/rack/mock.rb
|
Parent: | Object |
Rack::MockResponse provides useful helpers for testing your apps. Usually, you don’t create the MockResponse on your own, but use MockRequest.
body | [R] | Body |
errors | [RW] | Errors |
headers | [R] | Headers |
original_headers | [R] | Headers |
status | [R] | Status |
# File lib/rack/mock.rb, line 108 108: def initialize(status, headers, body, errors=StringIO.new("")) 109: @status = status.to_i 110: 111: @original_headers = headers 112: @headers = Rack::Utils::HeaderHash.new 113: headers.each { |field, values| 114: values.each { |value| 115: @headers[field] = value 116: } 117: } 118: 119: @body = "" 120: body.each { |part| @body << part } 121: 122: @errors = errors.string 123: end
# File lib/rack/mock.rb, line 158 158: def content_length 159: cl = headers["Content-Length"] 160: cl ? cl.to_i : cl 161: end