diff --git a/SfeduSchedule/Services/ModeusHttpClient.cs b/SfeduSchedule/Services/ModeusHttpClient.cs index 015cb9a..557ec0e 100644 --- a/SfeduSchedule/Services/ModeusHttpClient.cs +++ b/SfeduSchedule/Services/ModeusHttpClient.cs @@ -38,11 +38,11 @@ public class ModeusHttpClient public async Task GetScheduleAsync(ModeusScheduleRequest msr) { - var request = new HttpRequestMessage(HttpMethod.Post, + using var request = new HttpRequestMessage(HttpMethod.Post, $"schedule-calendar-v2/api/calendar/events/search?tz={_configuration["TZ"]!}"); request.Content = new StringContent(JsonSerializer.Serialize(msr, GlobalConsts.JsonSerializerOptions), Encoding.UTF8, "application/json"); - var response = await _httpClient.SendAsync(request); + using var response = await _httpClient.SendAsync(request); if (response.StatusCode != System.Net.HttpStatusCode.OK) { _logger.LogErrorHere($"Неуспешный статус при получении расписания: {response.StatusCode}, Request: {JsonSerializer.Serialize(msr, GlobalConsts.JsonSerializerOptions)}"); @@ -53,9 +53,9 @@ public class ModeusHttpClient public async Task> GetAttendeesAsync(Guid eventId) { - var request = new HttpRequestMessage(HttpMethod.Get, + using var request = new HttpRequestMessage(HttpMethod.Get, $"schedule-calendar-v2/api/calendar/events/{eventId}/attendees"); - var response = await _httpClient.SendAsync(request); + using var response = await _httpClient.SendAsync(request); if (response.StatusCode != System.Net.HttpStatusCode.OK) { _logger.LogErrorHere($"Неуспешный статус при получении расписания: {response.StatusCode}, eventId: {eventId}"); @@ -113,11 +113,11 @@ public class ModeusHttpClient public async Task SearchRoomsAsync(RoomSearchRequest requestDto) { - var request = new HttpRequestMessage(HttpMethod.Post, "schedule-calendar-v2/api/campus/rooms/search"); + using var request = new HttpRequestMessage(HttpMethod.Post, "schedule-calendar-v2/api/campus/rooms/search"); request.Content = new StringContent(JsonSerializer.Serialize(requestDto, GlobalConsts.JsonSerializerOptions), Encoding.UTF8, "application/json"); - var response = await _httpClient.SendAsync(request); + using var response = await _httpClient.SendAsync(request); if (response.StatusCode != System.Net.HttpStatusCode.OK) { _logger.LogErrorHere($"Неуспешный статус при получении расписания: {response.StatusCode}, Request: {JsonSerializer.Serialize(requestDto, GlobalConsts.JsonSerializerOptions)}");