class EventMachine::WebMockHttpClient
def make_raw_response(response)
def make_raw_response(response) response.raise_error_if_any status, headers, body = response.status, response.headers, response.body headers ||= {} response_string = [] response_string << "HTTP/1.1 #{status[0]} #{status[1]}" headers["Content-Length"] = body.bytesize unless headers["Content-Length"] headers.each do |header, value| if header =~ /set-cookie/i [value].flatten.each do |cookie| response_string << "#{header}: #{cookie}" end else value = value.join(", ") if value.is_a?(Array) # WebMock's internal processing will not handle the body # correctly if the header indicates that it is chunked, unless # we also create all the chunks. # It's far easier just to remove the header. next if header =~ /transfer-encoding/i && value =~/chunked/i response_string << "#{header}: #{value}" end end if headers response_string << "" << body response_string.join("\n") end