mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 01:53:39 +08:00
FIX: Add amazon sites to force_get_hosts (#12341)
It has been observed that doing a HEAD against an Amazon store URL may result in a 405 error being returned. Skipping the HEAD request may result in an improved oneboxing experience when requesting these URLs.
This commit is contained in:
parent
5b8941c568
commit
aed97c7bab
|
@ -27,7 +27,12 @@ module Oneboxer
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.force_get_hosts
|
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
|
end
|
||||||
|
|
||||||
def self.force_custom_user_agent_hosts
|
def self.force_custom_user_agent_hosts
|
||||||
|
|
|
@ -329,4 +329,10 @@ describe Oneboxer do
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user