Add User-Agent header to our OwlsValueGuide requests

Note: I validated this was working by temporarily changing the URI to
`https://echo.free.beeceptor.com`, which echoes the headers back, then
called `OwlsValueGuide.load_itemdata` directly.
This commit is contained in:
Emi Matchu 2024-04-09 06:59:44 -07:00
parent eb5f2a020c
commit 9ed34fa042
1 changed files with 3 additions and 1 deletions

View File

@ -36,7 +36,9 @@ module OwlsValueGuide
url = ITEMDATA_URL_TEMPLATE.expand(item_name: item_name)
begin
res = get(url)
res = get(url, headers: {
"User-Agent" => Rails.configuration.user_agent_for_neopets,
})
rescue StandardError => error
raise NetworkError, "Couldn't connect to Owls: #{error.message}"
end