Class: RoadForest::TestSupport::HTTPClient::Exchange::RequestBody
- Inherits:
-
Object
- Object
- RoadForest::TestSupport::HTTPClient::Exchange::RequestBody
- Defined in:
- lib/roadforest/test-support/http-client.rb
Instance Method Summary collapse
- #body ⇒ Object
- #each {|chunk| ... } ⇒ Object
-
#initialize(body) ⇒ RequestBody
constructor
A new instance of RequestBody.
-
#to_s ⇒ String
The request body as a string.
Constructor Details
#initialize(body) ⇒ RequestBody
Returns a new instance of RequestBody.
122 123 124 |
# File 'lib/roadforest/test-support/http-client.rb', line 122 def initialize(body) @raw_body = body end |
Instance Method Details
#body ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/roadforest/test-support/http-client.rb', line 126 def body @body = case @raw_body when IO, StringIO @raw_body.rewind @raw_body.read when String @raw_body else raise "Can't handle body type: #{@raw_body.class}" end end |
#each {|chunk| ... } ⇒ Object
147 148 149 |
# File 'lib/roadforest/test-support/http-client.rb', line 147 def each(&block) yield(body) end |
#to_s ⇒ String
Returns the request body as a string.
141 142 143 |
# File 'lib/roadforest/test-support/http-client.rb', line 141 def to_s body end |