Skip to content

Add request context capability mechanism to HTTPServer#166

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

Add request context capability mechanism to HTTPServer#166
ehaydenr wants to merge 1 commit into
apple:mainfrom
ehaydenr:requestcontext

Conversation

@ehaydenr
Copy link
Copy Markdown
Contributor

Introduce HTTPServerCapability namespace with a base RequestContext protocol, mirroring the client-side HTTPClientCapability.RequestOptions pattern. Servers declare a RequestContext associated type that handlers can constrain to require specific capabilities (e.g. connection info, peer certificates) at compile time.

Motivation

Clean up the client/server asymmetry. Afford the server APIs the same generic mechanism for requiring server capabilities.

Modifications

Added HTTPServerCapability.RequestContext protocol.

Result

Middleware and request handlers can now require server capabilities

Test Plan

Added a basic unit test to demonstrate the pattern.

Introduce HTTPServerCapability namespace with a base RequestContext
protocol, mirroring the client-side HTTPClientCapability.RequestOptions
pattern. Servers declare a RequestContext associated type that handlers
can constrain to require specific capabilities (e.g. connection info,
peer certificates) at compile time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant