Skip to content

Add HTTPVersion type and HTTPVersionInfo server capability - #188

Open
ehaydenr wants to merge 1 commit into
apple:mainfrom
ehaydenr:httpversion
Open

Add HTTPVersion type and HTTPVersionInfo server capability#188
ehaydenr wants to merge 1 commit into
apple:mainfrom
ehaydenr:httpversion

Conversation

@ehaydenr

Copy link
Copy Markdown
Contributor

Motivation

Handlers and middleware have no way to observe which HTTP version a request arrived over without coupling to a concrete server implementation. Fixes #180.

Modifications

Adds NetworkTypes.HTTPVersion and HTTPVersionInfo capability.

Result

Request contexts can advertise their HTTP version through the capability, and generic handlers can require it via a constraint rather than a concrete type. Purely additive; no existing API changes.

Test Plan

TestClientAndServer.HTTPRequestContext gains a httpVersion (defaulting to .http1_1) and conforms to the new capability, and the existing ServerCapabilityTests request-context test now asserts the version reaches the handler.

### Motivation

Handlers and middleware have no way to observe which HTTP version a request
arrived over without coupling to a concrete server implementation. Fixes apple#180.

### Modifications

Adds `NetworkTypes.HTTPVersion` and HTTPVersionInfo capability.

### Result

Request contexts can advertise their HTTP version through the capability, and
generic handlers can require it via a constraint rather than a concrete type.
Purely additive; no existing API changes.

### Test Plan

`TestClientAndServer.HTTPRequestContext` gains a `httpVersion` (defaulting to
`.http1_1`) and conforms to the new capability, and the existing
`ServerCapabilityTests` request-context test now asserts the version reaches the
handler.
@ehaydenr
ehaydenr requested a review from gjcairo August 27, 2026 10:37
@ehaydenr ehaydenr added the 🆕 semver/minor Adds new public API. label Aug 27, 2026
@ehaydenr
ehaydenr requested a review from FranzBusch August 27, 2026 10:45
@guoye-zhang

Copy link
Copy Markdown
Collaborator

There are some discussions on apple/swift-http-types#140

I think we should merge 1.1 and 1.0 into 1, and allow people to extend this with their custom versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add HTTPVersion type

3 participants