instance method send_early_hints

Ruby on Rails 6.0.6

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

send_early_hints(links)

Early Hints is an HTTP/2 status code that indicates hints to help a client start making preparations for processing the final response.

If the env contains rack.early_hints then the server accepts HTTP2 push for Link headers.

The send_early_hints method accepts a hash of links as follows:

send_early_hints("Link" => "</style.css>; rel=preload; as=style\n</script.js>; rel=preload")

If you are using javascript_include_tag or stylesheet_link_tag the Early Hints headers are included by default if supported.

Parameters

links req
Source
# File actionpack/lib/action_dispatch/http/request.rb, line 224
    def send_early_hints(links)
      return unless env["rack.early_hints"]

      env["rack.early_hints"].call(links)
    end

Defined in actionpack/lib/action_dispatch/http/request.rb line 224 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Request

Type at least 2 characters to search.

↑↓ navigate · open · esc close