Closed mehrdadkiani20 closed 2 months ago
Allow globally and locally set TLS version of the internal HttpClient
@mehrdadkiani20:
Timeout
has existed since version 1.0.0SslProtocols
added in version 1.6.0 and will be available shortlyUsage:
AdvancedRestHandler arh = new AdvancedRestHandler(string.Empty, new RestHandlerInitializerOptions
{
SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13,
Timeout = TimeSpan.FromSeconds(30)
});
var res = await arh.PostDataAsync<ArhResponse<ApiRes>, ApiReq>(
"/url-part/123",
new ApiReq(),
new RestHandlerRequestOptions
{
SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13,
Timeout = TimeSpan.FromSeconds(30)
});
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;