Class TimeoutHttpClient
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.dll
[Browsable(false)]
public class TimeoutHttpClient : HttpClient, IDisposable
- Inheritance
-
TimeoutHttpClient
- Implements
- Inherited Members
Constructors
TimeoutHttpClient(int, ICredentials?)
Initializes a new instance of the TimeoutHttpClient class with the specified timeout in seconds.
public TimeoutHttpClient(int timeoutInSeconds = 10, ICredentials? credentials = null)
Parameters
timeoutInSecondsintThe timeout in seconds.
credentialsICredentialsThe network credentials to use for authentication.
Properties
Encoding
Gets or sets the encoding used for the response content.
public Encoding Encoding { get; set; }
Property Value
FileName
Gets or sets the file name of the downloaded file.
public string? FileName { get; }
Property Value
Methods
GetRequestAsByteArray(string)
Sends a GET request to the specified URL and returns the response content as a byte array.
public byte[] GetRequestAsByteArray(string url)
Parameters
urlstringThe URL to send the request to.
Returns
- byte[]
The response content as a byte array.
GetRequestAsString(string)
Sends a GET request to the specified URL and returns the response content as a string.
public string GetRequestAsString(string url)
Parameters
urlstringThe URL to send the request to.
Returns
- string
The response content as a string.
PostRequest(string, string, string)
Sends a POST request to the specified URL with the provided content.
public string PostRequest(string url, string content, string mediaType = "application/json")
Parameters
urlstringThe URL to send the request to.
contentstringThe content to send in the request.
mediaTypestringThe media type of the content. Default is "application/json".
Returns
- string
The response from the server as a string.
PostRequestMultiData(string, string)
Sends a multi-part POST request to the specified URL.
public string PostRequestMultiData(string url, string postData)
Parameters
Returns
- string
The response from the server as a string.
TryEnableModernTlsSupport()
Tries to enable modern TLS support.
public static void TryEnableModernTlsSupport()