Enabled setting HttpMethod

This commit is contained in:
Casper Sparre 2026-02-19 20:00:31 +01:00
parent 3c3250e4e3
commit 307ed708ab

View File

@ -2773,7 +2773,7 @@ public class ApiService(IAuthService authService, IConfigService configService,
protected async Task<string?> BuildHeaderAndExecuteRequests(Dictionary<string, string> getParams, string endpoint,
HttpClient client)
HttpClient client, HttpMethod? method = null)
{
Log.Debug("Calling BuildHeaderAndExecuteRequests");
@ -2789,15 +2789,18 @@ public class ApiService(IAuthService authService, IConfigService configService,
protected Task<HttpRequestMessage> BuildHttpRequestMessage(Dictionary<string, string> getParams,
string endpoint)
string endpoint, HttpMethod? method = null)
{
Log.Debug("Calling BuildHttpRequestMessage");
string queryParams = "?" + string.Join("&", getParams.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string queryParams = "";
if (getParams.Count != 0)
queryParams = "?" + string.Join("&", getParams.Select(kvp => $"{kvp.Key}={kvp.Value}"));
Dictionary<string, string> headers = GetDynamicHeaders($"/api2/v2{endpoint}", queryParams);
HttpRequestMessage request = new(HttpMethod.Get, $"{Constants.ApiUrl}{endpoint}{queryParams}");
HttpRequestMessage request = new(method ?? HttpMethod.Get, $"{Constants.ApiUrl}{endpoint}{queryParams}");
Log.Debug($"Full request URL: {Constants.ApiUrl}{endpoint}{queryParams}");