Skip to content

Commit 7259ddd

Browse files
authored
Replace user-agent header. (#1206)
1 parent f72b456 commit 7259ddd

File tree

44 files changed

+55
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+55
-45
lines changed

config/ModuleMetadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
],
2323
"releaseNotes": "See https://aka.ms/GraphPowerShell-Release.",
2424
"assemblyOriginatorKeyFile": "35MSSharedLib1024.snk",
25-
"version": "1.9.4"
25+
"version": "1.9.5"
2626
}

src/Applications/Applications/readme.md

Lines changed: 1 addition & 1 deletion

src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;netcoreapp2.1;net461</TargetFrameworks>
55
<RootNamespace>Microsoft.Graph.PowerShell.Authentication.Core</RootNamespace>
6-
<Version>1.4.3</Version>
6+
<Version>1.9.5</Version>
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageReference Include="Microsoft.Graph.Auth" Version="1.0.0-preview.7" />

src/Authentication/Authentication/Helpers/HttpHelpers.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,24 @@ private static void PrependSDKHeader(HttpClient httpClient, string headerName, s
4242
httpClient.DefaultRequestHeaders.Add(headerName, previousSDKHeaders.Prepend(headerValue));
4343
}
4444
}
45+
46+
private static void ReplaceSDKHeader(HttpClient httpClient, string headerName, string headerValue)
47+
{
48+
if (!httpClient.DefaultRequestHeaders.Contains(headerName)) {
49+
httpClient.DefaultRequestHeaders.Add(headerName, headerValue);
50+
} else {
51+
httpClient.DefaultRequestHeaders.Remove(headerName);
52+
httpClient.DefaultRequestHeaders.Add(headerName, headerValue);
53+
}
54+
}
4555

4656
public static HttpClient GetGraphHttpClient(InvocationInfo invocationInfo, IAuthContext authContext = null)
4757
{
4858
authContext = authContext ?? GraphSession.Instance.AuthContext;
4959
if (authContext is null) { throw new AuthenticationException(Core.ErrorConstants.Message.MissingAuthContext); }
5060
var httpClient = GetGraphHttpClient(authContext);
5161
var requestUserAgent = new RequestUserAgent(authContext.PSHostVersion, invocationInfo);
52-
PrependSDKHeader(httpClient, HttpKnownHeaderNames.UserAgent, requestUserAgent.UserAgent);
62+
ReplaceSDKHeader(httpClient, HttpKnownHeaderNames.UserAgent, requestUserAgent.UserAgent);
5363
return httpClient;
5464
}
5565

src/Authentication/Authentication/Microsoft.Graph.Authentication.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<Version>1.7.0</Version>
3+
<Version>1.9.5</Version>
44
<LangVersion>7.1</LangVersion>
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<OutputType>Library</OutputType>

src/Authentication/Authentication/Microsoft.Graph.Authentication.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<package>
33
<metadata>
4-
<version>1.7.0</version>
4+
<version>1.9.5</version>
55
<id>Microsoft.Graph.Authentication</id>
66
<description>Microsoft Graph PowerShell authentication module</description>
77
<authors>Microsoft</authors>

src/Authentication/Authentication/Microsoft.Graph.Authentication.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft
55
#
6-
# Generated on: 3/30/2022
6+
# Generated on: 4/13/2022
77
#
88

99
@{
@@ -12,7 +12,7 @@
1212
RootModule = './Microsoft.Graph.Authentication.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.9.4'
15+
ModuleVersion = '1.9.5'
1616

1717
# Supported PSEditions
1818
CompatiblePSEditions = 'Core', 'Desktop'

src/Bookings/Bookings/readme.md

Lines changed: 1 addition & 1 deletion

src/Calendar/Calendar/readme.md

Lines changed: 1 addition & 1 deletion

src/ChangeNotifications/ChangeNotifications/readme.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)