Skip to content

Commit 5b586e7

Browse files
Add CBOR feature id and include it for operations called using CBOR protocol (#3933)
1 parent 64afa74 commit 5b586e7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

sdk/src/Core/Amazon.Runtime/Internal/UserAgent/UserAgentFeatureId.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public class UserAgentFeatureId : ConstantClass
5151
/// </summary>
5252
public static readonly UserAgentFeatureId GZIP_REQUEST_COMPRESSION = new UserAgentFeatureId("L");
5353

54+
/// <summary>
55+
/// An operation called using the Smithy RPC v2 CBOR protocol.
56+
/// </summary>
57+
public static readonly UserAgentFeatureId PROTOCOL_RPC_V2_CBOR = new UserAgentFeatureId("M");
58+
5459
/// <summary>
5560
/// An operation called using a user provided endpoint URL.
5661
/// </summary>

sdk/src/Core/Amazon.Runtime/Pipeline/Handlers/Marshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ private static void SetRecursionDetectionHeader(IDictionary<string, string> head
126126

127127
private static void UpdateUserAgentDetails(IRequestContext requestContext)
128128
{
129+
if (requestContext.Request.Headers.TryGetValue("smithy-protocol", out var smithyProtocol)
130+
&& smithyProtocol == "rpc-v2-cbor")
131+
{
132+
requestContext.UserAgentDetails.AddFeature(UserAgentFeatureId.PROTOCOL_RPC_V2_CBOR);
133+
}
134+
129135
var accountIdMode = requestContext.ClientConfig.AccountIdEndpointMode;
130136
if (accountIdMode == AccountIdEndpointMode.DISABLED)
131137
requestContext.UserAgentDetails.AddFeature(UserAgentFeatureId.ACCOUNT_ID_MODE_DISABLED);

0 commit comments

Comments
 (0)