microsoft / microsoft/aspire

Preserve endpoint name case sensitivity in Microsoft.Extensions.ServiceDiscovery

Open
#6,859 0 comments 0 reactions 0 assignees View on GitHub
area-service-discovery
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

I am trying to use customized service discovery logic by implementing my own `IServiceEndpointProviderFactory`, but I find that the service name used to consturct the `ServiceEndpointQuery` parameter to pass into `IServiceEndpointProviderFactory.TryCreateProvider()` method is always in lower case.
In some scenarios user might want to perform case-sensitive service endpoint lookup, so maybe we should somehow preserve the original string of the service name.

For example, the user may specify request url "https://Service-A/resource/{id}" and expecting "Service-A" as the endpoint key name. But with current implementation, the endpoint key name will become "service-a" because of

https://github.com/dotnet/aspire/blob/d9a982622c937f67ef805bf8c2142ecea1e7531a/src/Microsoft.Extensions.ServiceDiscovery/Http/HttpServiceEndpointResolver.cs#L42

### Describe the solution you'd like

Preserve case sensitivity of the target service name when resolving service endpoint, or at least make the original url string consumable somewhere downstream the `HttpServiceEndpointResolver`

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.