Refactor URL trimming logic in HTTP endpoint handlers (#6141)

Updated the URL trimming logic to ensure consistent handling of base URLs and paths, removing trailing slashes where necessary. This change improves the consistency and reliability of URL generation.
This commit is contained in:
Sipke Schoorstra 2024-11-22 21:30:41 +01:00 committed by GitHub
parent 90644f04f0
commit 08e0f8ed16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -9,8 +9,8 @@ public class DefaultHttpEndpointBasePathProvider(IOptions<HttpActivityOptions> o
{
public string GetBasePath()
{
var baseUrl = options.Value.BaseUrl;
var basePath = options.Value.BasePath;
var baseUrl = new Uri(options.Value.BaseUrl.ToString().TrimEnd('/'));
var basePath = options.Value.BasePath?.ToString().Trim('/');
var completeBaseUrl = new Uri(baseUrl, basePath);
return completeBaseUrl.ToString().TrimEnd('/') + '/';

View file

@ -19,7 +19,7 @@ public class HttpEndpointPathUIHandler(IHttpEndpointBasePathProvider httpEndpoin
{
[InputUIHints.SingleLine] = new SingleLineProps
{
AdornmentText = completeBaseUrl.TrimEnd('/') + '/',
AdornmentText = completeBaseUrl,
EnableCopyAdornment = true
},
["Refresh"] = true