Skip to content

Revisit settings/configuration Timeout type naming #92

@ktoso

Description

@ktoso

Hi there, was skimming the APIs a little bit and found the configuration type names a bit weird.

Specifically, the fields of Configuration using short names looks fun, but is also quite confusing imho, e.g. Timeout:

        var config = HTTPClient.Configuration()
        config.timeout = HTTPClient.Timeout() // this is not "a" Timeout, but configuration

        // a) rename? TimeoutConfiguration
        let t = HTTPClient.TimeoutConfiguration()
        // b) move? 
        let t = HTTPClient.Configuration.Timeout()

The types are nested in HTTPClient which makes it read like "this is the http client timeout", which it is not, it is just the settings what time timeouts shall be.

Looking at types:

public struct Configuration {
    public var tlsConfiguration: TLSConfiguration?
    public var followRedirects: Bool
    public var timeout: Timeout
    public var proxy: Proxy?
}

Timeout should likely be called TimeoutConfiguration; WDYT?

Proxy is likely fine, since that indeed is the value of the proxy to be used... though tbh future proof would be to make it a Configuration as well IMHO (in case it'd get per destination proxying or not etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions