Adopt AHC's .shared singleton as the default Client by czechboy0 · Pull Request #39 · swift-server/swift-openapi-async-http-client (original) (raw)
Motivation
As a convenience when you don't need to create a custom AHC Client instance, we provide a singleton client as the default. AHC added their own Client.shared singleton, so let's adopt that and remove the transport's internal singleton, which was used for the same purpose.
Modifications
- Replaced the tranport's internal singleton with the AHC-provided one.
- Use Int64 directly and skip conversions now that AHC also uses Int64 for the body byte size.
Result
- No internal singleton is created now, possibly avoiding having two AHC singletons in a given process.
- Fixed a warning around Int/Int64 conversion.
Test Plan
Unit tests still pass.