Async::WebSocket SourceAsyncWebSocketResponse

module Response

Definitions

def self.for(request, headers = nil, **options, &body)

Send the request to the given connection.

Implementation

def self.for(request, headers = nil, **options, &body)
	if request.version =~ /http\/1/i
		return UpgradeResponse.new(request, headers, **options, &body)
	elsif request.version =~ /http\/2/i
		return ConnectResponse.new(request, headers, **options, &body)
	end
	
	raise UnsupportedVersionError, "Unsupported HTTP version: #{request.version}!"
end