refactor(BaseHttpClientService): Verwendung von IEnumerable<KeyValuePair<string, object>> anstelle von Dictionary<string, string> in queryParams, form und headers inputs der FetchAsync Methode
This commit is contained in:
parent
0c2334cefb
commit
0334fc4cdf
@ -12,11 +12,11 @@ namespace DigitalData.Core.Abstractions.Client
|
|||||||
string? scheme = null,
|
string? scheme = null,
|
||||||
int? port = null,
|
int? port = null,
|
||||||
string path = "",
|
string path = "",
|
||||||
Dictionary<string, object?>? queryParams = null,
|
IEnumerable<KeyValuePair<string, object?>>? queryParams = null,
|
||||||
HttpMethod? method = null,
|
HttpMethod? method = null,
|
||||||
HttpContent? body = null,
|
HttpContent? body = null,
|
||||||
Dictionary<string, string>? form = null,
|
IEnumerable<KeyValuePair<string, object>>? form = null,
|
||||||
Dictionary<string, string>? headers = null,
|
IEnumerable<KeyValuePair<string, object>>? headers = null,
|
||||||
bool sendWithCookie = true,
|
bool sendWithCookie = true,
|
||||||
bool saveCookie = true
|
bool saveCookie = true
|
||||||
);
|
);
|
||||||
|
|||||||
@ -30,11 +30,11 @@ namespace DigitalData.Core.Client
|
|||||||
string? scheme = null,
|
string? scheme = null,
|
||||||
int? port = null,
|
int? port = null,
|
||||||
string path = "",
|
string path = "",
|
||||||
Dictionary<string, object?>? queryParams = null,
|
IEnumerable<KeyValuePair<string, object?>>? queryParams = null,
|
||||||
HttpMethod? method = null,
|
HttpMethod? method = null,
|
||||||
HttpContent? body = null,
|
HttpContent? body = null,
|
||||||
Dictionary<string, string>? form = null,
|
IEnumerable<KeyValuePair<string, object>>? form = null,
|
||||||
Dictionary<string, string>? headers = null,
|
IEnumerable<KeyValuePair<string, object>>? headers = null,
|
||||||
bool sendWithCookie = true,
|
bool sendWithCookie = true,
|
||||||
bool saveCookie = true
|
bool saveCookie = true
|
||||||
)
|
)
|
||||||
@ -76,7 +76,7 @@ namespace DigitalData.Core.Client
|
|||||||
var requestMessage = new HttpRequestMessage(method, requestUri);
|
var requestMessage = new HttpRequestMessage(method, requestUri);
|
||||||
|
|
||||||
// Add headers if provided
|
// Add headers if provided
|
||||||
headers?.ForEach(header => requestMessage.Headers.Add(header.Key, header.Value));
|
headers?.ForEach(header => requestMessage.Headers.Add(header.Key, header.Value.ToString()));
|
||||||
|
|
||||||
// Add cookie to request
|
// Add cookie to request
|
||||||
if (sendWithCookie)
|
if (sendWithCookie)
|
||||||
@ -94,7 +94,7 @@ namespace DigitalData.Core.Client
|
|||||||
else if (body != null)
|
else if (body != null)
|
||||||
requestMessage.Content = body;
|
requestMessage.Content = body;
|
||||||
else if (form != null)
|
else if (form != null)
|
||||||
requestMessage.Content = new FormUrlEncodedContent(form);
|
requestMessage.Content = new FormUrlEncodedContent(form.Select(e => KeyValuePair.Create(e.Key, e.Value.ToString())));
|
||||||
|
|
||||||
var response = await _client.SendAsync(requestMessage);
|
var response = await _client.SendAsync(requestMessage);
|
||||||
|
|
||||||
|
|||||||
@ -53,8 +53,8 @@ Global
|
|||||||
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Debug|Any CPU.Build.0 = Release|Any CPU
|
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0B051A5F-BD38-47D1-BAFF-D44BA30D3FB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user