do not apply locale_redirection if sitemap.xml is requested
did
committed Mar 07, 2016
commit b203eb1df950992bccbcb12ff14e7f860ee32d6b
Showing 2
changed files with
6 additions
and 1 deletions
locomotive/steam/middlewares/locale_redirection.rb b/lib/locomotive/steam/middlewares/locale_redirection.rb
+1
-1
| @@ | @@ -29,7 +29,7 @@ module Locomotive::Steam |
| end | |
| def apply_redirection? | |
| - | site.locales.size > 1 && request.get? |
| + | site.locales.size > 1 && request.get? && env['PATH_INFO'] != '/sitemap.xml' |
| end | |
| def default_locale? | |
spec/unit/middlewares/locale_redirection_spec.rb
+5
-0
| @@ | @@ -90,6 +90,11 @@ describe Locomotive::Steam::Middlewares::LocaleRedirection do |
| it { is_expected.to eq [301, '/mounted-on/somewhere/de/hello/world'] } | |
| end | |
| + | describe 'requesting sitemap.xml' do |
| + | let(:url) { 'http://models.example.com/sitemap.xml' } |
| + | it { is_expected.to eq [200, nil] } |
| + | end |
| + | |
| end | |
| describe 'with locale' do | |