From 9ed34fa042df2d75eeacf72e7c11907434c30206 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 9 Apr 2024 06:59:44 -0700 Subject: [PATCH] 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. --- app/services/owls_value_guide.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/owls_value_guide.rb b/app/services/owls_value_guide.rb index de03189e..5c57e122 100644 --- a/app/services/owls_value_guide.rb +++ b/app/services/owls_value_guide.rb @@ -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