Skip to content

HTTPClient.shared (like URLSession.shared)? #700

Closed
@weissi

Description

@weissi
private let sharedSingleton: HTTPClient = {
    let httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
    Unmanaged.takeUnretained(httpClient) // don't ever deinit this guy
}()

extension HTTPClient {
    public var shared: HTTPClient {
        return sharedSingleton
    }
}

? This has some issues around the configuration (solved by #392) but I'm pretty sure we can just create a somewhat sensible configuration that is standard and call it a day. If users do need special config, they can always create their own HTTPClient(eventLoopGroupProvider: .singleton, configuration: ...).

Possible once #697 is merged

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.kind/supportAdopter support requests.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions