mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
DEV: early hints around_action -> after_action (#26423)
Using around_action means `add_early_hint_header` is in the stack for every request, and gets included in the backtrace of any errors.
We can manage with an after_action instead, which avoids adding to the stack depth (and avoids people blaming me for unrelated application errors 😉)
This commit is contained in:
@ -53,7 +53,7 @@ class ApplicationController < ActionController::Base
|
||||
after_action :add_noindex_header_to_non_canonical, if: :spa_boot_request?
|
||||
after_action :set_cross_origin_opener_policy_header, if: :spa_boot_request?
|
||||
after_action :clean_xml, if: :is_feed_response?
|
||||
around_action :add_early_hint_header, if: -> { spa_boot_request? }
|
||||
after_action :add_early_hint_header, if: -> { spa_boot_request? }
|
||||
|
||||
HONEYPOT_KEY ||= "HONEYPOT_KEY"
|
||||
CHALLENGE_KEY ||= "CHALLENGE_KEY"
|
||||
@ -1100,11 +1100,7 @@ class ApplicationController < ActionController::Base
|
||||
# to cache a response header from the app and use that to send an Early Hint response to future clients.
|
||||
# See 'early_hint_header_mode' and 'early_hint_header_name' Global Setting descriptions for more info.
|
||||
def add_early_hint_header
|
||||
return yield if GlobalSetting.early_hint_header_mode.nil?
|
||||
|
||||
@asset_preload_links = []
|
||||
|
||||
yield
|
||||
return if GlobalSetting.early_hint_header_mode.nil?
|
||||
|
||||
links = []
|
||||
|
||||
|
Reference in New Issue
Block a user