Method: HTTPAdapter#specialize_response

Defined in:
lib/httpadapter.rb

#specialize_response(response_ary) ⇒ Array

Converts a tuple to a specific HTTP implementation’s response format.

Parameters:

  • response_ary (Array)

    The response object to be converted. The response object must be a tuple with a length of 3. The first element must be the HTTP status code. The second element contains the headers. It must respond to #each and iterate over the header names and values. The third element must be the body. It must respond to #each but may not be a String. It should emit String objects. This is essentially the same format that Rack uses.

Returns:

  • (Array)

    The implementation-specific response object.



123
124
125
126
127
128
129
130
131
# File 'lib/httpadapter.rb', line 123

def specialize_response(response_ary)
  response_ary = HTTPAdapter.verified_response(response_ary)
  if self.respond_to?(:convert_response_from_a)
    return self.convert_response_from_a(response_ary)
  else
    raise TypeError,
      'Expected adapter to implement #convert_response_from_a.'
  end
end