From c3005c6371dc750937d8fd82173d770f1ad70b3b Mon Sep 17 00:00:00 2001 From: Garth Brantley Date: Sun, 11 Sep 2022 16:11:13 -0400 Subject: [PATCH] Send standard user agent for php client API requests. --- src/SubscribePro/Http.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/SubscribePro/Http.php b/src/SubscribePro/Http.php index db11f95..f8a4814 100644 --- a/src/SubscribePro/Http.php +++ b/src/SubscribePro/Http.php @@ -35,6 +35,11 @@ class Http */ public const DEFAULT_LOG_MESSAGE_FORMAT = "{method} - {uri}\nRequest body: {req_body}\n{code} {phrase}\nResponse body: {res_body}\n{error}\n"; + /** + * User agent string for outgoing API requests. + */ + public const USER_AGENT = 'subscribepro-php/1.1'; + /** * @var string */ @@ -86,6 +91,9 @@ protected function createClient() RequestOptions::HTTP_ERRORS => false, RequestOptions::AUTH => [$this->app->getClientId(), $this->app->getClientSecret()], RequestOptions::TIMEOUT => $this->requestTimeout, + RequestOptions::HEADERS => [ + 'User-Agent' => self::USER_AGENT, + ] ]); }