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:
parent
eb5f2a020c
commit
9ed34fa042
1 changed files with 3 additions and 1 deletions
|
@ -36,7 +36,9 @@ module OwlsValueGuide
|
||||||
|
|
||||||
url = ITEMDATA_URL_TEMPLATE.expand(item_name: item_name)
|
url = ITEMDATA_URL_TEMPLATE.expand(item_name: item_name)
|
||||||
begin
|
begin
|
||||||
res = get(url)
|
res = get(url, headers: {
|
||||||
|
"User-Agent" => Rails.configuration.user_agent_for_neopets,
|
||||||
|
})
|
||||||
rescue StandardError => error
|
rescue StandardError => error
|
||||||
raise NetworkError, "Couldn't connect to Owls: #{error.message}"
|
raise NetworkError, "Couldn't connect to Owls: #{error.message}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue