diff --git a/sdk/src/Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs b/sdk/src/Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs index 6ead057028a8..3b7fc0315665 100644 --- a/sdk/src/Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs +++ b/sdk/src/Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs @@ -115,9 +115,7 @@ private static void SetUserAgentHeader(IRequestContext requestContext) if (!string.IsNullOrEmpty(clientAppId)) sb.Append(" app/").Append(InternalSDKUtils.ReplaceInvalidUserAgentCharacters(clientAppId)); - var retryMode = ToUserAgentHeaderString(requestContext.ClientConfig.RetryMode); - Debug.Assert(retryMode != requestContext.ClientConfig.RetryMode.ToString().ToLower(), "Invalid RetryMode string."); - sb.Append(" cfg/retry-mode#}").Append(retryMode); + sb.Append(" cfg/retry-mode#}").Append(ToUserAgentHeaderString(requestContext.ClientConfig.RetryMode)); sb.Append(" md/").Append(requestContext.IsAsync ? "ClientAsync" : "ClientSync"); @@ -143,10 +141,15 @@ private static void SetUserAgentHeader(IRequestContext requestContext) private static string ToUserAgentHeaderString(RequestRetryMode requestRetryMode) { - if (requestRetryMode == RequestRetryMode.Adaptive) - return "adaptive"; - else - return "standard"; + switch (requestRetryMode) + { + case RequestRetryMode.Standard: + return "standard"; + case RequestRetryMode.Adaptive: + return "adaptive"; + default: + return requestRetryMode.ToString().ToLowerInvariant(); + } } } } diff --git a/sdk/test/Services/SecurityToken/UnitTests/Custom/StaticCheckTests.cs b/sdk/test/Services/SecurityToken/UnitTests/Custom/StaticCheckTests.cs index 1f516a944cfd..1b576b6ae127 100644 --- a/sdk/test/Services/SecurityToken/UnitTests/Custom/StaticCheckTests.cs +++ b/sdk/test/Services/SecurityToken/UnitTests/Custom/StaticCheckTests.cs @@ -83,5 +83,15 @@ public void EnsureCredentialProfileDetectorSetup() // the properties are used at least once. Assert.IsTrue(profileOptionsProperties.SetEquals(referencedProfileOptionsProperties)); } + + [TestMethod] + public void LookForRequestRetryModeChanges() + { + var expectedHash = "2FC699DB6A4284C5D53F3B7FA4E64165576FD1F6AE458BC737AE503F06DFBE4C"; + AssertExtensions.AssertEnumUnchanged( + typeof(RequestRetryMode), + expectedHash, + "The Amazon.Runtime.Internal.Marshaller.ToUserAgentHeaderString method implementation may need to be updated."); + } } } \ No newline at end of file