-
Notifications
You must be signed in to change notification settings - Fork 16
Use HTTPClient.shared
as default
#38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
AHC provides a shared
HTTPClient
now so we should use that instead of creating our own.Modifications
Use
HTTPClient.shared
as the defaultHTTPClient
.Result
Apps won't be using 2 different shared
HTTPClient
s.Test Plan
The change does not seem to need test changes.