Skip to content

A platform for community discussion. Free, open, simple.

FIX: Add amazon sites to force_get_hosts (#12341)

jbrwaed97c7babc1
diff --git a/lib/oneboxer.rb b/lib/oneboxer.rb
index 19580fc4b41..79f5070374f 100644
--- a/lib/oneboxer.rb
+++ b/lib/oneboxer.rb
@@ -27,7 +27,12 @@ module Oneboxer
end
def self.force_get_hosts
- @force_get_hosts ||= ['http://us.battle.net', 'https://news.yahoo.com/']
+ @force_get_hosts ||= begin
+ hosts = ['http://us.battle.net', 'https://news.yahoo.com']
+ amazon_suffixes = %w(com com.br ca cn fr de in it co.jp com.mx nl pl sa sg es se com.tr ae co.uk)
+
+ hosts + amazon_suffixes.collect { |suffix| "https://www.amazon.#{suffix}" }
+ end
end
def self.force_custom_user_agent_hosts
diff --git a/spec/components/oneboxer_spec.rb b/spec/components/oneboxer_spec.rb
index c260a0ae261..5d6681422b7 100644
--- a/spec/components/oneboxer_spec.rb
+++ b/spec/components/oneboxer_spec.rb
@@ -329,4 +329,10 @@ describe Oneboxer do
end
end
+ describe '#force_get_hosts' do
+ it "includes Amazon sites" do
+ expect(Oneboxer.force_get_hosts).to include('https://www.amazon.ca')
+ end
+ end
+
end