mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-05-03 07:32:29 +00:00
c621142327
Migrate CI to use GitHub Actions. ### Motivation: To migrate to GitHub actions and centralised infrastructure. ### Modifications: Changes of note: * Adopt swift-format using rules from SwiftNIO. * Remove scripts and docker files which are no longer needed. * Disabled warnings-as-errors on Swift 6.0 CI pipelines for now. ### Result: Feature parity with old CI.
36 lines
1.3 KiB
Swift
36 lines
1.3 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the AsyncHTTPClient open source project
|
|
//
|
|
// Copyright (c) 2023 Apple Inc. and the AsyncHTTPClient project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
extension HTTPClient {
|
|
/// A globally shared, singleton ``HTTPClient``.
|
|
///
|
|
/// The returned client uses the following settings:
|
|
/// - configuration is ``HTTPClient/Configuration/singletonConfiguration`` (matching the platform's default/prevalent browser as well as possible)
|
|
/// - `EventLoopGroup` is ``HTTPClient/defaultEventLoopGroup`` (matching the platform default)
|
|
/// - logging is disabled
|
|
public static var shared: HTTPClient {
|
|
globallySharedHTTPClient
|
|
}
|
|
}
|
|
|
|
private let globallySharedHTTPClient: HTTPClient = {
|
|
let httpClient = HTTPClient(
|
|
eventLoopGroup: HTTPClient.defaultEventLoopGroup,
|
|
configuration: .singletonConfiguration,
|
|
backgroundActivityLogger: HTTPClient.loggingDisabled,
|
|
canBeShutDown: false
|
|
)
|
|
return httpClient
|
|
}()
|