refactor: replace URI string concatenation with EndsWith check
Replace new Uri(url.TrimEnd('/') + "/") pattern with explicit
EndsWith('/') check to avoid string concatenation inside URI
construction. Applies to 3 locations:
- Program.cs (Heimdall.Web) - HttpClient base address
- TokenRefreshHandler.cs - raw HttpClient for token refresh
- Program.cs (Heimdall.Agent) - Central service client
This commit is contained in:
1 parent
9e58b5bf55
commit
87eb0982a7
3 files changed
+6
-3
No files matched your search
@@ -368,7 +368,8 @@ public partial class Program {
|
||||
?? "http://localhost:8080";
|
||||
builder.Services.AddHttpClient("HeimdallApi", client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(apiBaseUrl.TrimEnd('/') + "/");
|
||||
var baseUrl = apiBaseUrl.EndsWith('/') ? apiBaseUrl : apiBaseUrl + "/";
|
||||
client.BaseAddress = new Uri(baseUrl);
|
||||
client.Timeout = TimeSpan.FromSeconds(30);
|
||||
}).AddHttpMessageHandler<TokenRefreshHandler>();
|
||||
|
||||
|
||||
Reference in new issue
Block a user