swift-server / swift-server/async-http-client
HTTPClient.Configuration.init parameter `redirectConfiguration` inconsistently named and suboptimal type
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 156
- PR merge metrics
- No merged PRs in 30d
Description
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):
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the HTTPClient.Configuration.init entry point and the RedirectConfiguration definition, then inspect call sites and existing tests for the current optional parameter behavior. Done means the redirect parameter naming and default value are corrected, the initializer is deprecated as requested, and the other optional initializers are addressed with coverage for the public API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100