From 99857edbf58ceeea446f25612977228d18614244 Mon Sep 17 00:00:00 2001 From: Tim Rogers Date: Wed, 18 May 2022 12:07:31 +0000 Subject: [PATCH] Tweak `User-Agent` to refer to `Octokit.net`, not just `Octokit` This improves the `User-Agent` header sent by Octokit.net to explicitly refer to `Octokit.net`, rather than just `Octokit`. This will make it easier to identify requests from this SDK in GitHub logs and other reporting. --- Octokit.Tests/Http/ConnectionTests.cs | 3 ++- Octokit/Http/Connection.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Octokit.Tests/Http/ConnectionTests.cs b/Octokit.Tests/Http/ConnectionTests.cs index c38aee0759..8caa91d23d 100644 --- a/Octokit.Tests/Http/ConnectionTests.cs +++ b/Octokit.Tests/Http/ConnectionTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -749,6 +749,7 @@ public void CreatesConnectionWithBaseAddress() Assert.Equal(new Uri("https://github.com/"), connection.BaseAddress); Assert.StartsWith("OctokitTests (", connection.UserAgent); + Assert.Contains("Octokit.net", connection.UserAgent); } } diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index 81759fdc2a..7a75783113 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -763,7 +763,7 @@ internal static TwoFactorType ParseTwoFactorType(IResponse restResponse) static string FormatUserAgent(ProductHeaderValue productInformation) { - return string.Format(CultureInfo.InvariantCulture, "{0} ({1}; {2}; Octokit {3})", + return string.Format(CultureInfo.InvariantCulture, "{0} ({1}; {2}; Octokit.net {3})", productInformation, GetPlatformInformation(), GetCultureInformation(),