feat(BaseHttpClientService): Uri Getter und Setter entfernt und geschützte readonly _uri Variable hinzugefügt.
This commit is contained in:
parent
049e9977f4
commit
bcfb5a8a70
@ -4,8 +4,6 @@ namespace DigitalData.Core.Abstractions.Client
|
||||
{
|
||||
public interface IBaseHttpClientService
|
||||
{
|
||||
string Uri { get; init; }
|
||||
|
||||
CookieCollection GetCookies(string path = "");
|
||||
|
||||
Task<HttpResponseMessage> FetchAsync(
|
||||
|
||||
@ -12,7 +12,7 @@ namespace DigitalData.Core.Client
|
||||
protected readonly CookieContainer _cookies;
|
||||
|
||||
[StringSyntax("Uri")]
|
||||
public string Uri { get; init; }
|
||||
protected readonly string _uri;
|
||||
|
||||
public string Path { get; init; } = string.Empty;
|
||||
|
||||
@ -24,13 +24,13 @@ namespace DigitalData.Core.Client
|
||||
{
|
||||
_client = client;
|
||||
_cookies = cookieContainer;
|
||||
Uri = clientOptions.Value.Uri.Trim(URI_TRIM_CHARS);
|
||||
_uri = clientOptions.Value.Uri.Trim(URI_TRIM_CHARS);
|
||||
Path = clientOptions.Value.Path.Trim(URI_TRIM_CHARS);
|
||||
_headers = clientOptions.Value.Headers;
|
||||
_queryParams = clientOptions.Value.QueryParams;
|
||||
}
|
||||
|
||||
public CookieCollection GetCookies(string path = "") => _cookies.GetCookies(uri: new Uri(UriCombine(Uri, path, path.Trim(URI_TRIM_CHARS))));
|
||||
public CookieCollection GetCookies(string path = "") => _cookies.GetCookies(uri: new Uri(UriCombine(_uri, path, path.Trim(URI_TRIM_CHARS))));
|
||||
|
||||
public async Task<HttpResponseMessage> FetchAsync(
|
||||
string? scheme = null,
|
||||
@ -65,7 +65,7 @@ namespace DigitalData.Core.Client
|
||||
method ??= HttpMethod.Get;
|
||||
|
||||
// create URL
|
||||
var uriBuilder = new UriBuilder(Uri);
|
||||
var uriBuilder = new UriBuilder(_uri);
|
||||
if (scheme is not null)
|
||||
uriBuilder.Scheme = scheme;
|
||||
if (port is int portInt)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user