Use `HTTPClient.shared` as default
Motivation
AHC provides a shared HTTPClient now so we should use that instead of creating our own.
Modifications
Use HTTPClient.shared as the default HTTPClient.
Result
Apps won't be using 2 different shared HTTPClients.
Test Plan
The change does not seem to need test changes.
@swift-server-bot test this please
@MahdiBM the nightly/swift-6 pipeline seems to have failed, can you take a look?
Errors:
/code/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift:91:14: error: associated value 'invalidRequestURL(request:baseURL:)' of 'Sendable'-conforming enum 'Error' has non-sendable type 'URL'; this is an error in the Swift 6 language mode
89 |
90 | /// Invalid URL composed from base URL and received request.
91 | case invalidRequestURL(request: HTTPRequest, baseURL: URL)
| `- error: associated value 'invalidRequestURL(request:baseURL:)' of 'Sendable'-conforming enum 'Error' has non-sendable type 'URL'; this is an error in the Swift 6 language mode
92 |
93 | // MARK: CustomStringConvertible
Foundation.URL:1:15: note: struct 'URL' does not conform to the 'Sendable' protocol
1 | public struct URL : ReferenceConvertible, Equatable {
| `- note: struct 'URL' does not conform to the 'Sendable' protocol
2 | public typealias ReferenceType = NSURL
3 | public init?(string: String)
[1095/1105] Compiling OpenAPIAsyncHTTPClient AsyncHTTPClientTransport.swift
/code/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift:91:14: error: associated value 'invalidRequestURL(request:baseURL:)' of 'Sendable'-conforming enum 'Error' has non-sendable type 'URL'; this is an error in the Swift 6 language mode
89 |
90 | /// Invalid URL composed from base URL and received request.
91 | case invalidRequestURL(request: HTTPRequest, baseURL: URL)
| `- error: associated value 'invalidRequestURL(request:baseURL:)' of 'Sendable'-conforming enum 'Error' has non-sendable type 'URL'; this is an error in the Swift 6 language mode
92 |
93 | // MARK: CustomStringConvertible
Foundation.URL:1:15: note: struct 'URL' does not conform to the 'Sendable' protocol
1 | public struct URL : ReferenceConvertible, Equatable {
| `- note: struct 'URL' does not conform to the 'Sendable' protocol
2 | public typealias ReferenceType = NSURL
3 | public init?(string: String)
/code/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift:23:17: error: '@preconcurrency' attribute on module 'Foundation' has no effect
21 | import Foundation
22 | #else
23 | @preconcurrency import struct Foundation.URL
| `- error: '@preconcurrency' attribute on module 'Foundation' has no effect
24 | import struct Foundation.URLComponents
25 | import struct Foundation.Data
They seem to be unrelated to this PR.
Non-the-less I added a condition to a #if to only apply @preconcurrency when Swift version is less than 6.
I also enabled the strict-concurrency flag.
Seems like this was done in another PR