Add HTTPVersion type and HTTPVersionInfo server capability - #188
Open
ehaydenr wants to merge 1 commit into
Open
Conversation
### 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.
gjcairo
approved these changes
Aug 27, 2026
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.HTTPVersionand 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.HTTPRequestContextgains ahttpVersion(defaulting to.http1_1) and conforms to the new capability, and the existingServerCapabilityTestsrequest-context test now asserts the version reaches the handler.