dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.12k stars 340 forks source link

Handle the case where appid contains at least one upperletter #1233

Closed TWEESTY closed 9 months ago

TWEESTY commented 9 months ago

Description

The .NET SDK Client for Dapr does not handle the case where the app id contains an upper character for HTPP service invocation, because it uses the property Host of the URI, which is case insensitive (always in lower case), inside the class InvocationHandler.

The change is to use the appid sent when creating the HTTPClient or if there is no appId, use the host issued by the original string of the URI to get the correct app id (i.e. case sensitive).

The DaprClient can always be used for another appid if the user put an absolute URI.

There is no breaking change.

Issue reference

[#937]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (ca2fab2) 67.17% compared to head (cfa1bb2) 67.20%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1233 +/- ## ========================================== + Coverage 67.17% 67.20% +0.02% ========================================== Files 174 174 Lines 5986 5991 +5 Branches 667 668 +1 ========================================== + Hits 4021 4026 +5 Misses 1798 1798 Partials 167 167 ``` | [Flag](https://app.codecov.io/gh/dapr/dotnet-sdk/pull/1233/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | Coverage Δ | | |---|---|---| | [net6](https://app.codecov.io/gh/dapr/dotnet-sdk/pull/1233/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | `67.17% <100.00%> (+0.02%)` | :arrow_up: | | [net7](https://app.codecov.io/gh/dapr/dotnet-sdk/pull/1233/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | `67.17% <100.00%> (+0.02%)` | :arrow_up: | | [net8](https://app.codecov.io/gh/dapr/dotnet-sdk/pull/1233/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr) | `67.18% <100.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dapr#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

TWEESTY commented 9 months ago

I'd prefer to avoid the URL parsing if the principal scenario is unblocked without it.

Alright I've updated the code in this way?