Swiftpack.co - Package - amzn/smoke-http

Build - Master Branch Linux Swift 5.0 Compatible Swift 5.1 Compatible Join the Smoke Server Side community on gitter Apache 2


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 (HTTPClientDelegate, HTTPClientChannelInboundHandlerDelegate) that are defined by the client-specific logic.

Getting Started

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")

    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)

where clientDelegate conforms to the HTTPClientDelegate protocol.


This library is licensed under the Apache 2.0 License.


Stars: 40
Help us keep the lights on


2.0.0.alpha.1 - Nov 6, 2019

  1. Adopt SwiftLog 1, passing the logger explicitly (#31)
  2. Adopt SwiftMetrics 1 and record invocation metrics (#32)
  3. Adopt Swift.Result rather than our own Result types. (#29)
  4. Expose the http response code when throwing client errors (#33)
  5. Move SwiftNIO dependency to major version 2 (#35)
  6. Remove compatibility for Swift versions prior to 5 (#28)
  7. 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.