From eb5f2a020c8a73092536de8ed4dc9c1bab58ad9b Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 9 Apr 2024 06:58:03 -0700 Subject: [PATCH] Add User-Agent header to our NeopetsMediaArchive 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 `NeopetsMediaArchive.load_file_from_origin` directly. --- app/services/neopets_media_archive.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/neopets_media_archive.rb b/app/services/neopets_media_archive.rb index a4ac1236..26ff34dc 100644 --- a/app/services/neopets_media_archive.rb +++ b/app/services/neopets_media_archive.rb @@ -72,7 +72,9 @@ module NeopetsMediaArchive # We use this in the `swf_assets:manifests:load` task to perform many # requests in parallel! Sync do - response = INTERNET.get(uri) + response = INTERNET.get(uri, [ + ["User-Agent", Rails.configuration.user_agent_for_neopets], + ]) if response.status != 200 raise ResponseNotOK.new(response.status), "expected status 200 but got #{response.status} (#{uri})"