- Updated docker-compose.yml to include environment variables and health checks for the app service. - Modified Dockerfile to install curl for health checks and adjusted the build process for backend services. - Improved user notification handling in activation, blocking, and config revocation commands by integrating Telegram notifications. - Added new test cases to validate the updated command handlers and Telegram notifier functionality. - Enhanced documentation to reflect the new Telegram bot features and user management improvements.
23 lines
961 B
C#
23 lines
961 B
C#
using System.Net.Http.Headers;
|
|
using System.Net.Http.Json;
|
|
using System.Text.Json;
|
|
|
|
namespace PnvPanel.IntegrationTests.TestSupport;
|
|
|
|
public static class HttpClientJsonExtensions
|
|
{
|
|
public static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
|
|
|
|
public static void UseBearerToken(this HttpClient client, string accessToken)
|
|
=> client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
|
|
|
|
public static async Task<T?> ReadAsAsync<T>(this HttpResponseMessage response)
|
|
=> await response.Content.ReadFromJsonAsync<T>(JsonOptions);
|
|
|
|
public static Task<HttpResponseMessage> PostJsonAsync(this HttpClient client, string url, object body)
|
|
=> client.PostAsJsonAsync(url, body, JsonOptions);
|
|
|
|
public static Task<HttpResponseMessage> SendPutJsonAsync(this HttpClient client, string url, object body)
|
|
=> client.PutAsJsonAsync(url, body, JsonOptions);
|
|
}
|