class RoadForest::TestSupport::HTTPClient::Exchange::RequestBody

Public Class Methods

new(body) click to toggle source

@param request the request from Mongrel

# File lib/roadforest/test-support/http-client.rb, line 122
def initialize(body)
  @raw_body = body
end

Public Instance Methods

body() click to toggle source
# 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() { |body| ... } click to toggle source

@yield [chunk] @yieldparam [String] chunk a chunk of the request body

# File lib/roadforest/test-support/http-client.rb, line 147
def each(&block)
  yield(body)
end
to_s() click to toggle source

@return [String] the request body as a string

# File lib/roadforest/test-support/http-client.rb, line 141
def to_s
  body
end