-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: URLSession-based HTTP Client (#636)
- Loading branch information
Showing
21 changed files
with
803 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 37 additions & 8 deletions
45
Sources/ClientRuntime/Networking/Http/HttpClientConfiguration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
import struct Foundation.TimeInterval | ||
|
||
public class HttpClientConfiguration { | ||
public var protocolType: ProtocolType | ||
// initialize with default headers | ||
|
||
/// The timeout for a request, in seconds. | ||
/// | ||
/// If none is provided, the client will use default values based on the platform. | ||
public var connectTimeout: TimeInterval? | ||
|
||
/// HTTP headers to be submitted with every HTTP request. | ||
/// | ||
/// If none is provided, defaults to no extra headers. | ||
public var defaultHeaders: Headers | ||
|
||
// add any other properties here you want to give the service operations | ||
// control over to be mapped to the Http Client | ||
|
||
public init(protocolType: ProtocolType = .https, | ||
defaultHeaders: Headers = Headers()) { | ||
/// The URL scheme to be used for HTTP requests. Supported values are `http` and `https`. | ||
/// | ||
/// If none is provided, the default protocol for the operation will be used | ||
public var protocolType: ProtocolType? | ||
|
||
/// Creates a configuration object for a SDK HTTP client. | ||
/// | ||
/// Not all configuration settings may be followed by all clients. | ||
/// - Parameters: | ||
/// - connectTimeout: The maximum time to wait for a response without receiving any data. | ||
/// - defaultHeaders: HTTP headers to be included with every HTTP request. | ||
/// Note that certain headers may cause your API request to fail. Defaults to no headers. | ||
/// - protocolType: The HTTP scheme (`http` or `https`) to be used for API requests. Defaults to the operation's standard configuration. | ||
public init( | ||
connectTimeout: TimeInterval? = nil, | ||
protocolType: ProtocolType = .https, | ||
defaultHeaders: Headers = Headers() | ||
) { | ||
self.protocolType = protocolType | ||
self.defaultHeaders = defaultHeaders | ||
self.connectTimeout = connectTimeout | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.