class Protocol::Rack::Adapter::Rack2

def call(request)

@raises [ArgumentError] If the status is not an integer or headers are nil.
@returns [Protocol::HTTP::Response] The HTTP response.
@parameter request [Protocol::HTTP::Request] The incoming request.

Build a rack `env` from the incoming request and apply it to the rack middleware.
def call(request)
	env = self.make_environment(request)
	
	status, headers, body = @app.call(env)
	
	if status
		status = status.to_i
	else
		raise ArgumentError, "Status must be an integer!"
	end
	
	unless headers
		raise ArgumentError, "Headers must not be nil!"
	end
	
	# unless body.respond_to?(:each)
	# 	raise ArgumentError, "Body must respond to #each!"
	# end
	
	headers, meta = self.wrap_headers(headers)
	
	# Rack 2 spec does not allow only partial hijacking.
	# if hijack_body = meta[RACK_HIJACK]
	# 	body = hijack_body
	# end
	
	return Response.wrap(env, status, headers, meta, body, request)
rescue => exception
	Console.error(self, exception)
	
	body&.close if body.respond_to?(:close)
	
	return failure_response(exception)
end