Skip to content

HTTPClient.Configuration.init parameter redirectConfiguration inconsistently named and suboptimal type #197

Open
@weissi

Description

@weissi

This is quite a minor issue but redirectConfiguration sticks out:

public init(tlsConfiguration: TLSConfiguration? = nil,
            redirectConfiguration: RedirectConfiguration? = nil,
            timeout: Timeout = Timeout(),
            proxy: Proxy? = nil,
            ignoreUncleanSSLShutdown: Bool = false,
            decompression: Decompression = .disabled) {

When I'm initialising a Configuration, I know that I'd be configuring the redirect configuration. I think it should be called redirects: or something similar.

Also, the type isn't great. It shouldn't be optional.

See Xcode's completion (which is accurate):

Screenshot 2020-04-05 at 20 46 56

You'd expect that .none and .disallow are the same but .none secretly means "default" (which is not .disallow). The parameter should be non-optional and default to a new value .default.

We should deprecate this init and also fix the other optional ones.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions