swift-server / swift-server/async-http-client

Remove dependency on Foundation?

Open
#299 9 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
1.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

AsyncHTTPClient is currently dependent on Foundation. Would removing this dependency be a target for AHC?

I have done a quick test to see where Foundation is being used. The main source is unsurprisingly URL. The other two are Date/DateFormatter which might be difficult to replace but are used in one very specific place (Cookie expiry dates) and Data which is used in StreamWriter.data and in Authorization.basic where a string is converted to Data to convert it to base64.

To still allow interface functions that use Foundation types they could be moved out to a AsyncHTTPClientFoundationCompat library à la swift-nio. The implementation of HTTPClient functions that take a URL could be moved there along with StreamWriter.data.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Foundation uses named in the issue: URL, Date/DateFormatter for cookie expiry, and Data in StreamWriter.data and Authorization.basic. Review the proposed AsyncHTTPClientFoundationCompat boundary and determine the concrete scope and acceptance criteria for removing the dependency; the issue does not currently define what done looks like.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.