From d50672fd7365a33ce3898b121c363b35c4a3f269 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Tue, 9 Apr 2024 06:55:41 -0700 Subject: [PATCH] Add User-Agent header to our AMFPHP requests Oh right, I never did catch this when setting up User-Agent in the app! (I noticed this because I'm making a new request now, and went to look how we set it in previous stuff, and was like. Oh. We don't anywhere right now. Interesting LOL) --- app/models/pet.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/pet.rb b/app/models/pet.rb index 1f74fb9c..ee222cef 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -158,7 +158,9 @@ class Pet < ApplicationRecord # Return the response body as a `HashWithIndifferentAccess`. def self.send_amfphp_request(request, timeout: 10) begin - response = request.post(timeout: timeout) + response = request.post(timeout: timeout, headers: { + "User-Agent" => Rails.configuration.user_agent_for_neopets, + }) rescue RocketAMFExtensions::RemoteGateway::AMFError => e raise DownloadError, e.message rescue RocketAMFExtensions::RemoteGateway::ConnectionError => e