Skip to content

Commit 9663e89

Browse files
authored
Set User-Agent for HTTP requests (#612)
1 parent 29a3fb9 commit 9663e89

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/WingetCreateCore/Common/PackageParser.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace Microsoft.WingetCreateCore
1111
using System.IO;
1212
using System.Linq;
1313
using System.Net.Http;
14+
using System.Net.Http.Headers;
1415
using System.Security.Cryptography;
1516
using System.Text.RegularExpressions;
1617
using System.Threading.Tasks;
@@ -46,7 +47,13 @@ public static class PackageParser
4647
"nullsoft",
4748
};
4849

49-
private static HttpClient httpClient = new HttpClient();
50+
private static HttpClient httpClient = new()
51+
{
52+
DefaultRequestHeaders =
53+
{
54+
UserAgent = { new ProductInfoHeaderValue("WinGetCreate", Utils.GetEntryAssemblyVersion()) },
55+
},
56+
};
5057

5158
private enum MachineType
5259
{

0 commit comments

Comments
 (0)