Method: HTTPX::AltSvc.emit

Defined in:
lib/httpx/altsvc.rb

.emit(request, response) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/httpx/altsvc.rb', line 39

def emit(request, response)
  # Alt-Svc
  return unless response.headers.key?("alt-svc")

  origin = request.origin
  host = request.uri.host
  parse(response.headers["alt-svc"]) do |alt_origin, alt_params|
    alt_origin.host ||= host
    yield(alt_origin, origin, alt_params)
  end
end