Skip to content

Commit fd72bbd

Browse files
authored
Fix setting User-Agent for dotnet scenarios (#620)
1 parent 6721123 commit fd72bbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/UniversalPackages/DownloadUniversalPackages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ private string GetArtifactToolReleaseInfoUrl(string osName, string arch)
629629
string json = webClient.DownloadString(ReleaseInfoUrl);
630630
#else
631631
using HttpClient httpClient = new HttpClient();
632-
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Microsoft.Build.UniversalPackages"));
632+
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Microsoft.Build.UniversalPackages");
633633
string json = httpClient.GetStringAsync(ReleaseInfoUrl).GetAwaiter().GetResult();
634634
#endif
635635

0 commit comments

Comments
 (0)