### 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.
Default the configuration parameter
### Motivation
The AsyncHTTPClient transport API has undergone changes in recent months and we didn't bring back the default initializer after we adopted the shared EventLoopGroup, allowing you to create a transport with just `let transport = AsyncHTTPClientTransport()`.
### Modifications
Default the configuration parameter in the initializer to be able to do that. It's already documented to work, but it doesn't.
### Result
Match the documented behavior of being able to use `let transport = AsyncHTTPClientTransport()`.
### Test Plan
Tests still pass.
Reviewed by: dnadoba
Builds:
✔︎ pull request validation (5.10) - Build finished.
✔︎ pull request validation (5.9) - Build finished.
✔︎ pull request validation (nightly) - Build finished.
✔︎ pull request validation (soundness) - Build finished.
https://github.com/swift-server/swift-openapi-async-http-client/pull/32
Handle large payloads on 32bit platforms gracefully
### Motivation
If there's a request payload with a number of bytes that can't fit into 32 bits, we'd crash.
### Modifications
Use a graceful initializer and use `.unknown` (so no `content-length` will be sent) if the size exceeds the max of a 32bit int.
### Result
No crash for large payloads on 32bit platforms.
### Test Plan
Tests pass.
Reviewed by: dnadoba
Builds:
✔︎ pull request validation (5.10) - Build finished.
✔︎ pull request validation (5.9) - Build finished.
✔︎ pull request validation (nightly) - Build finished.
✔︎ pull request validation (soundness) - Build finished.
https://github.com/swift-server/swift-openapi-async-http-client/pull/29
### Motivation
On main, the HTTPBody length type changed from Int to Int64.
### Modifications
Adapted the transport with this change.
### Result
Repo builds again when using the latest runtime.
### Test Plan
Adapted tests.
### Motivation
- Relates to
[#230](https://github.com/apple/swift-openapi-generator/issues/230)
### Modifications
- Disable respectsExistingLineBreaks .swift-format rule and address
changes requested
### Result
- One of the .swift-format rules will be disabled
### Test Plan
- Run Tests
### Motivation
We previously defaulted the HTTPClient to .init(), but that's not
correct as it was never getting shut down.
### Modifications
Instead of creating a new client, just introduce our own shared one and
use that as the default value.
Once AHC provides a shared client, we can default to that in the
configuration initializer.
### Result
No more crashing clients on dealloc.
### Test Plan
All tests pass.
---------
Co-authored-by: David Nadoba <dnadoba@gmail.com>
Fix double encoding of path parameters
### Motivation
Fixes https://github.com/apple/swift-openapi-generator/issues/251.
### Modifications
Use the already escaped path setter on `URLComponents` to avoid the second encoding pass.
### Result
Path parameters that needed escaping are only escaped once, not twice.
### Test Plan
Adapted the existing unit test to cover a path item that needs escaping.
Reviewed by: simonjbeaumont
Builds:
✔︎ pull request validation (5.8) - Build finished.
✔︎ pull request validation (5.9) - Build finished.
✔︎ pull request validation (nightly) - Build finished.
✔︎ pull request validation (soundness) - Build finished.
https://github.com/swift-server/swift-openapi-async-http-client/pull/15
Adopt the new shared HTTP client
### Motivation
Now that SwiftNIO/AsyncHTTPClient have a singleton variant of the `EventLoopGroup`, which allows creating an `HTTPClient` without any argument, let's simplify the initializer of the transport to take advantage of it - bringing it in line with the URLSession transport.
### Modifications
Default the HTTPClient to a new one with a default event loop group, and remove the mandatory shutdown call.
### Result
Adopters can more easily create the AHC transport.
### Test Plan
N/A
Reviewed by: dnadoba, glbrntt
Builds:
✔︎ pull request validation (5.8) - Build finished.
✔︎ pull request validation (5.9) - Build finished.
✔︎ pull request validation (nightly) - Build finished.
✔︎ pull request validation (soundness) - Build finished.
https://github.com/swift-server/swift-openapi-async-http-client/pull/13
Enable strict concurrency checking in CI
### Motivation
To further avoid concurrency bugs, enable complete concurrency checking in CI.
### Modifications
Added the compiler flag to the docker-compose scripts.
### Result
If a warning of this nature comes up, because we have warnings-as-errors, it'll fail CI.
### Test Plan
Locally built without any warnings with the flag enabled.
Reviewed by: glbrntt
Builds:
✔︎ pull request validation (5.8) - Build finished.
✔︎ pull request validation (5.9) - Build finished.
✔︎ pull request validation (nightly) - Build finished.
✔︎ pull request validation (soundness) - Build finished.
https://github.com/swift-server/swift-openapi-async-http-client/pull/11