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)
This commit is contained in:
Emi Matchu 2024-04-09 06:55:41 -07:00
parent 58d86cf3ac
commit d50672fd73

View file

@ -158,7 +158,9 @@ class Pet < ApplicationRecord
# Return the response body as a `HashWithIndifferentAccess`. # Return the response body as a `HashWithIndifferentAccess`.
def self.send_amfphp_request(request, timeout: 10) def self.send_amfphp_request(request, timeout: 10)
begin 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 rescue RocketAMFExtensions::RemoteGateway::AMFError => e
raise DownloadError, e.message raise DownloadError, e.message
rescue RocketAMFExtensions::RemoteGateway::ConnectionError => e rescue RocketAMFExtensions::RemoteGateway::ConnectionError => e