From 1754f17d93d7d24f2e343de36157db8d5f983828 Mon Sep 17 00:00:00 2001 From: David Yaffe Date: Wed, 3 Jun 2026 18:59:45 +0000 Subject: [PATCH] Add enableAwsChunked context flag --- .../Context/Context+Chunked.swift | 18 ++++++++++++++++++ .../Context/SigningPropertyKeys.swift | 1 + 2 files changed, 19 insertions(+) diff --git a/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift b/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift index f3c3e41fb..f2de56ada 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift @@ -7,12 +7,30 @@ import struct Smithy.AttributeKey import class Smithy.Context +import class Smithy.ContextBuilder public extension Context { var isChunkedEligibleStream: Bool? { get { get(key: isChunkedEligibleStreamKey) } set { set(key: isChunkedEligibleStreamKey, value: newValue) } } + + /// Flag controlling whether aws-chunked content encoding may be used for eligible + /// streaming requests. When `false`, aws-chunked encoding is disabled even for + /// eligible streams. Defaults to `true` when unset to preserve existing behavior. + var enableAwsChunked: Bool { + get { get(key: enableAwsChunkedKey) ?? true } + set { set(key: enableAwsChunkedKey, value: newValue) } + } +} + +public extension ContextBuilder { + @discardableResult + func withEnableAwsChunked(value: Bool) -> Self { + self.attributes.set(key: enableAwsChunkedKey, value: value) + return self + } } private let isChunkedEligibleStreamKey = AttributeKey(name: "isChunkedEligibleStreamKey") +private let enableAwsChunkedKey = AttributeKey(name: "enableAwsChunkedKey") diff --git a/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift b/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift index 85d95c000..c56c06bdb 100644 --- a/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift +++ b/Sources/SmithyHTTPAuthAPI/Context/SigningPropertyKeys.swift @@ -17,6 +17,7 @@ public enum SigningPropertyKeys { public static let clockSkew = AttributeKey(name: "ClockSkew") public static let expiration = AttributeKey(name: "Expiration") public static let isChunkedEligibleStream = AttributeKey(name: "isChunkedEligibleStream") + public static let enableAwsChunked = AttributeKey(name: "enableAwsChunked") public static let omitSessionToken = AttributeKey(name: "OmitSessionToken") public static let shouldNormalizeURIPath = AttributeKey(name: "ShouldNormalizeURIPath") public static let signatureType = AttributeKey(name: "SignatureType")