Method: Excon::Connection#requests

Defined in:
lib/excon/connection.rb

#requests(pipeline_params) ⇒ Object

Sends the supplied requests to the destination host using pipelining.

@pipeline_params [Array<Hash>] pipeline_params An array of one or more optional params, override defaults set in Connection.new, see #request for details


261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/excon/connection.rb', line 261

def requests(pipeline_params)
  pipeline_params.each {|params| params.merge!(:pipeline => true, :persistent => true) }
  pipeline_params.last.merge!(:persistent => @data[:persistent])

  responses = pipeline_params.map do |params|
    request(params)
  end.map do |datum|
    Excon::Response.new(response(datum)[:response])
  end

  if @data[:persistent]
    if key = responses.last[:headers].keys.detect {|k| k.casecmp('Connection') == 0 }
      if responses.last[:headers][key].casecmp('close') == 0
        reset
      end
    end
  else
    reset
  end

  responses
end