Skip to content

Conversation

onurkanbakirci
Copy link
Contributor

@onurkanbakirci onurkanbakirci commented Sep 7, 2025

Fixes #50522

This PR introduces a new HttpContext.Endpoint property, providing direct access to the selected Endpoint associated with the current request.

- 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.
@Copilot Copilot AI review requested due to automatic review settings September 7, 2025 12:00
Copy link
Contributor

@Copilot Copilot AI left a 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 to HttpContext 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

Comment on lines +219 to +220
get { return this.GetEndpoint(); }
set { this.SetEndpoint(value); }
Copy link
Preview

Copilot AI Sep 7, 2025

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.

@github-actions github-actions bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Sep 7, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 7, 2025
@gfoidl

This comment was marked as resolved.

Copy link
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add HttpContext.Endpoint property
2 participants