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:
parent
90644f04f0
commit
08e0f8ed16
|
|
@ -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('/') + '/';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class HttpEndpointPathUIHandler(IHttpEndpointBasePathProvider httpEndpoin
|
|||
{
|
||||
[InputUIHints.SingleLine] = new SingleLineProps
|
||||
{
|
||||
AdornmentText = completeBaseUrl.TrimEnd('/') + '/',
|
||||
AdornmentText = completeBaseUrl,
|
||||
EnableCopyAdornment = true
|
||||
},
|
||||
["Refresh"] = true
|
||||
|
|
|
|||
Loading…
Reference in a new issue