class Falcon::Adapters::EarlyHints

Provide an interface for advising the client to preload related resources.

def call(headers)

Extract link headers and invoke {push}.
def call(headers)
	headers.each do |key, value|
		if key.casecmp("link").zero? and match = PRELOAD.match(value)
			@request.push(match[:path])
		else
			Async.logger.warn(@request) {"Unsure how to handle early hints header: #{key}"}
		end
	end
end

def initialize(request)

@parameter request [Protocol::HTTP::Request]

Initialize the early hints interface.
def initialize(request)
	@request = request
end

def push(path, preload: true, **options)

@parameter preload [Boolean] whether the client should preload the resource.
@parameter path [String]
Advise the request that the specified path should be preloaded.
def push(path, preload: true, **options)
	@request.push(path)
end