Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
MahdiBM wants to merge 4 commits into swift-server:main from MahdiBM:mmbm-use-shared-httpclient

Conversation

Copy link
Contributor

@MahdiBM MahdiBM commented Apr 12, 2024

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.

Copy link
Collaborator

@swift-server-bot test this please

Copy link
Collaborator

@MahdiBM the nightly/swift-6 pipeline seems to have failed, can you take a look?

MahdiBM reacted with thumbs up emoji

Copy link
Contributor Author

MahdiBM commented Apr 20, 2024
edited
Loading

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.

Copy link
Contributor Author

MahdiBM commented Oct 7, 2024

Seems like this was done in another PR

czechboy0 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /