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
|
public interface IBaseHttpClientService
|
||||||
{
|
{
|
||||||
string Uri { get; init; }
|
|
||||||
|
|
||||||
CookieCollection GetCookies(string path = "");
|
CookieCollection GetCookies(string path = "");
|
||||||
|
|
||||||
Task<HttpResponseMessage> FetchAsync(
|
Task<HttpResponseMessage> FetchAsync(
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace DigitalData.Core.Client
|
|||||||
protected readonly CookieContainer _cookies;
|
protected readonly CookieContainer _cookies;
|
||||||
|
|
||||||
[StringSyntax("Uri")]
|
[StringSyntax("Uri")]
|
||||||
public string Uri { get; init; }
|
protected readonly string _uri;
|
||||||
|
|
||||||
public string Path { get; init; } = string.Empty;
|
public string Path { get; init; } = string.Empty;
|
||||||
|
|
||||||
@ -24,13 +24,13 @@ namespace DigitalData.Core.Client
|
|||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
_cookies = cookieContainer;
|
_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);
|
Path = clientOptions.Value.Path.Trim(URI_TRIM_CHARS);
|
||||||
_headers = clientOptions.Value.Headers;
|
_headers = clientOptions.Value.Headers;
|
||||||
_queryParams = clientOptions.Value.QueryParams;
|
_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(
|
public async Task<HttpResponseMessage> FetchAsync(
|
||||||
string? scheme = null,
|
string? scheme = null,
|
||||||
@ -65,7 +65,7 @@ namespace DigitalData.Core.Client
|
|||||||
method ??= HttpMethod.Get;
|
method ??= HttpMethod.Get;
|
||||||
|
|
||||||
// create URL
|
// create URL
|
||||||
var uriBuilder = new UriBuilder(Uri);
|
var uriBuilder = new UriBuilder(_uri);
|
||||||
if (scheme is not null)
|
if (scheme is not null)
|
||||||
uriBuilder.Scheme = scheme;
|
uriBuilder.Scheme = scheme;
|
||||||
if (port is int portInt)
|
if (port is int portInt)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user