SmokeHTTP contains the library SmokeHTTPClient which will allow someone building a specific client that requires unique use-cases for HTTP parameters to utilize a generic HTTPClient that allows the user to implement their own delegates that handles client-specific HTTP logic.
The benefit of this package is to consolidate all HTTPClient logic into one location, while other clients are built to utilize this client while defining their own specific delegates.
To use SmokeHTTPClient, a user can instantiate an
HTTPClient in the constructor of their specific client with instantiated delegates (
HTTPClientChannelInboundHandlerDelegate) that are defined by the client-specific logic.
Step 1: Add the SmokeHTTP dependency
SmokeHTTP uses the Swift Package Manager. To use the framework, add the following dependency to your Package.swift-
dependencies: [ .package(url: "https://github.com/amzn/smoke-http.git", from: "1.0.0") ] .target( name: ..., dependencies: [..., "SmokeHTTPClient"]),
Step 2: Construct a HTTPClient
Construct a HTTPClient using the following code-
import SmokeHTTPClient let httpClient = HTTPClient(endpointHostName: endpointHostName, endpointPort: endpointPort, contentType: contentType, clientDelegate: clientDelegate, connectionTimeoutSeconds: connectionTimeoutSeconds)
clientDelegate conforms to the
This library is licensed under the Apache 2.0 License.
Help us keep the lights on
2.0.0.alpha.1 - Nov 6, 2019
- Adopt SwiftLog 1, passing the logger explicitly (#31)
- Adopt SwiftMetrics 1 and record invocation metrics (#32)
- Adopt Swift.Result rather than our own Result types. (#29)
- Expose the http response code when throwing client errors (#33)
- Move SwiftNIO dependency to major version 2 (#35)
- Remove compatibility for Swift versions prior to 5 (#28)
- Client waits during connecting (#25)
1.0.1 - Oct 1, 2019
Remove compiler warnings under Swift 5.x
1.0.0 - Apr 4, 2019
This release of SmokeHTTP provides compatibility with Swift 4.1 and Swift 4.2 using SwiftNIO 1.x.
0.9.0 - Apr 2, 2019
Implement a number of internal fixes to be more efficient in memory usage, including using NIOFoundationCompat to convert directly from a ByteBuffer to Foundation.Data when receiving the response in HTTPClient.
0.8.0 - Mar 26, 2019
Add a key transform strategy for encoding and decoding shapes with a passthrough option, an option to capitalise and de-capitalise the first character and a custom transform. This is enable use cases where there is a known mapping from the Codable instance to the serialised form that cannot be fully expressed as CodingKeys (the mapping is different in different circumstances.