-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add Endpoint property to HttpContext and DefaultHttpContext #63575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Introduced an abstract Endpoint property in HttpContext for getting and setting the current request's endpoint. - Implemented the Endpoint property in DefaultHttpContext, allowing retrieval and assignment of endpoint values. - Added unit tests to verify the behavior of the Endpoint property, including default value, roundtrip setting, and consistency with extension methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Endpoint
property to the HttpContext
abstract class and implements it in DefaultHttpContext
, providing direct access to the current request's endpoint without requiring extension methods.
- Added abstract
Endpoint
property toHttpContext
base class with comprehensive XML documentation - Implemented the property in
DefaultHttpContext
using existing extension methods for consistency - Updated debug view to use the new property instead of extension method
- Added comprehensive test coverage for the new property
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Http/Http.Abstractions/src/HttpContext.cs | Added abstract Endpoint property with XML documentation and updated debug view |
src/Http/Http/src/DefaultHttpContext.cs | Implemented Endpoint property using existing GetEndpoint() and SetEndpoint() extension methods |
src/Http/Http.Abstractions/test/EndpointHttpContextExtensionsTests.cs | Added comprehensive test coverage for the new property behavior |
src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt | Added public API entries for the new property getter and setter |
get { return this.GetEndpoint(); } | ||
set { this.SetEndpoint(value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The braces should be placed on separate lines according to the .editorconfig formatting guidelines. The getter and setter should be formatted as:\ncsharp\nget\n{\n return this.GetEndpoint();\n}\nset\n{\n this.SetEndpoint(value);\n}\n
Copilot generated this review using guidance from repository custom instructions.
This comment was marked as resolved.
This comment was marked as resolved.
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Fixes #50522
This PR introduces a new
HttpContext.Endpoint
property, providing direct access to the selectedEndpoint
associated with the current request.