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:
jbrw 2021-03-10 14:42:17 -05:00 committed by GitHub
parent 5b8941c568
commit aed97c7bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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