Class: Riddl::Client::SimulateRequest

Inherits:
Net::HTTPGenericRequest
  • Object
show all
Defined in:
lib/ruby/riddl/client.rb

Overview

}}}

Instance Method Summary collapse

Constructor Details

#initialize(method, path, parameters, headers, qs) ⇒ SimulateRequest

{{{



423
424
425
426
427
428
429
430
# File 'lib/ruby/riddl/client.rb', line 423

def initialize(method, path, parameters, headers, qs)
  path = (path.strip == '' ? '/' : path)
  path += "?#{qs}" unless qs == ''
  super method, true, true, path, headers
  tmp = Protocols::HTTP::Generator.new(parameters,self).generate(:input)
  self.content_length = tmp.size
  self.body_stream = tmp
end

Instance Method Details

#simulateObject



436
437
438
439
440
441
442
443
444
# File 'lib/ruby/riddl/client.rb', line 436

def simulate
  sock = StringIO.new('')
  sock.define_singleton_method(:io) do
    sock
  end
  self.exec(sock,"1.1",self.path)
  sock.rewind
  [nil, sock, []]
end

#supply_default_content_typeObject



432
433
434
# File 'lib/ruby/riddl/client.rb', line 432

def supply_default_content_type
  ### none, Protocols::HTTP::Generator handles this
end