Open jonmarozick opened 8 months ago
@paulomorgado is this a known regression? Should we fix that?
Woulnd't it be better to ensure that BaseUrl always ends with a '/' when its value is assigned?
@RicoSuter,
The strategy is now to guarantee that the base URL has the trailing /
.
Maybe we should do the other way around and remove the trailing /
from the base URL and force on the path.
Or maybe we should just use the Uri
class for that. But that would be a breaking change.
@jonmarozick,
What changes did you have to make in the constructor? Does this PR (#4691) fix it?
@vvdb-architecture
Woulnd't it be better to ensure that BaseUrl always ends with a '/' when its value is assigned?
That's the strategy now.
This is my base class. I just ensured that the base url has a trialing slash. PR #4691 looks like it will fix it. Thanks.
public class ApiClientBase
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiClientBase"/> class.
/// </summary>
/// <param name="configuration">The configuration.</param>
public ApiClientBase(DomainIdentityApiClientConfiguration configuration)
{
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
// this.BaseUrl = configuration.BaseUrl; <----- original code
this.BaseUrl = configuration.BaseUrl != null ? configuration.BaseUrl.TrimEnd('/') + "/" : string.Empty;
}
/// <summary>
/// Gets or sets the base URL.
/// </summary>
protected string BaseUrl { get; set; }
}
When upgrading from version 13.20 to 14.0 the following generated C# code no longer prepends a slash to the path.
v13.20 code
v14.0 code
This change was not listed on the breaking changes section. Was this intentional?
I was able to work-around this by adding code the base class constructor, but it was a surprise.