Commit ed5dfe62 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'remove-asset-host-prefetch-feature-flag' into 'master'

Remove asset_host_prefetch feature flag

See merge request gitlab-org/gitlab!26868
parents 0c6ecbce c3e69a4a
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
%head{ prefix: "og: http://ogp.me/ns#" } %head{ prefix: "og: http://ogp.me/ns#" }
%meta{ charset: "utf-8" } %meta{ charset: "utf-8" }
- if Feature.enabled?('asset_host_prefetch') && ActionController::Base.asset_host - if ActionController::Base.asset_host
%link{ rel: 'dns-prefetch', href: ActionController::Base.asset_host } %link{ rel: 'dns-prefetch', href: ActionController::Base.asset_host }
%link{ rel: 'preconnnect', href: ActionController::Base.asset_host, crossorigin: '' } %link{ rel: 'preconnnect', href: ActionController::Base.asset_host, crossorigin: '' }
......
---
title: Prefetch DNS for asset host
merge_request: 26868
author:
type: performance
...@@ -34,36 +34,23 @@ describe 'layouts/_head' do ...@@ -34,36 +34,23 @@ describe 'layouts/_head' do
expect(rendered).to match(%{content="foo" http-equiv="refresh"}) expect(rendered).to match(%{content="foo" http-equiv="refresh"})
end end
context 'when an asset_host is set and feature is activated in the config it will' do context 'when an asset_host is set' do
let(:asset_host) { 'http://assets' } let(:asset_host) { 'http://assets' }
before do before do
stub_feature_flags(asset_host_prefetch: true)
allow(ActionController::Base).to receive(:asset_host).and_return(asset_host) allow(ActionController::Base).to receive(:asset_host).and_return(asset_host)
end end
it 'add a link dns-prefetch tag' do it 'adds a link dns-prefetch tag' do
render render
expect(rendered).to match('<link href="http://assets" rel="dns-prefetch">')
end
it 'add a link preconnect tag' do
render
expect(rendered).to match('<link crossorigin="" href="http://assets" rel="preconnnect">')
end
end
context 'when an asset_host is set and feature is not activated in the config it will' do expect(rendered).to match(%Q(<link href="#{asset_host}" rel="dns-prefetch">))
let(:asset_host) { 'http://assets' }
before do
stub_feature_flags(asset_host_prefetch: false)
allow(ActionController::Base).to receive(:asset_host).and_return(asset_host)
end end
it 'not add a link dns-prefetch tag' do it 'adds a link preconnect tag' do
render render
expect(rendered).not_to match('<link href="http://assets" rel="dns-prefetch">')
expect(rendered).to match(%Q(<link crossorigin="" href="#{asset_host}" rel="preconnnect">))
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment