Protocol::RackSourceProtocolRackAdapterRack3

class Rack3

Definitions

def wrap_headers(fields)

Process the rack response headers into into a Protocol::HTTP::Headers instance, along with any extra rack. metadata.

Signature

returns Tuple(Protocol::HTTP::Headers, Hash)

Implementation

def wrap_headers(fields)
	headers = ::Protocol::HTTP::Headers.new
	meta = {}
	
	fields.each do |key, value|
		key = key.downcase
		
		if key.start_with?("rack.")
			meta[key] = value
		elsif value.is_a?(Array)
			value.each do |value|
				headers[key] = value
			end
		else
			headers[key] = value
		end
	end
	
	return headers, meta
end