Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Sources/SmithyHTTPAuthAPI/Context/Context+Chunked.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bool>(name: "isChunkedEligibleStreamKey")
private let enableAwsChunkedKey = AttributeKey<Bool>(name: "enableAwsChunkedKey")
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public enum SigningPropertyKeys {
public static let clockSkew = AttributeKey<TimeInterval>(name: "ClockSkew")
public static let expiration = AttributeKey<TimeInterval>(name: "Expiration")
public static let isChunkedEligibleStream = AttributeKey<Bool>(name: "isChunkedEligibleStream")
public static let enableAwsChunked = AttributeKey<Bool>(name: "enableAwsChunked")
public static let omitSessionToken = AttributeKey<Bool>(name: "OmitSessionToken")
public static let shouldNormalizeURIPath = AttributeKey<Bool>(name: "ShouldNormalizeURIPath")
public static let signatureType = AttributeKey<AWSSignatureType>(name: "SignatureType")
Expand Down
Loading