IHttpClientService
Wisej.AI.Services.IHttpClientService
Last updated
Wisej.AI.Services.IHttpClientService
Last updated
Namespace: Wisej.AI.Services
Assembly: Wisej.AI (3.5.0.0)
Represents a service for handling HTTP client operations with customizable handlers and headers.
The interface provides methods for sending HTTP requests and handling responses. It allows setting a custom , adding and removing default headers, and executing various HTTP methods like GET and POST. This interface is intended to be implemented by classes that encapsulate HTTP client logic, enabling easy configuration and request execution.
: Returns the underlying instance.
: Gets or sets the timeout.
Sends an asynchronous GET request to the specified URI.
uri
The URI to send the request to. This parameter is optional and defaults to an empty string if not provided.
Throws:
Sends an asynchronous POST request to the specified URI with the given content.
uri
The URI to send the request to. This parameter is optional and defaults to an empty string if not provided.
content
The HTTP content to send with the request. This parameter is optional and defaults to null if not provided.
Throws:
Removes a default header from the requests.
key
The name of the header to remove. This parameter is optional and defaults to an empty string if not provided.
Sends an asynchronous HTTP request to the specified URI.
request
The HTTP request message to send.
Throws:
Adds a default header to be included in all requests.
key
The name of the header to add. This parameter is optional and defaults to an empty string if not provided.
value
The value of the header to add. This parameter is optional and defaults to an empty string if not provided.
Sets a custom HTTP client handler for the service.
handler
Represents a default HTTP client service that provides methods to send HTTP requests and manage default headers.
Returns: . A task representing the asynchronous operation, containing the HTTP response message.
The method sends an HTTP GET request to the specified URI and returns the response. This is typically used for retrieving data from a web service. Example usage:
Thrown when uri is null.
Returns: . A task representing the asynchronous operation, containing the HTTP response message.
The method sends an HTTP POST request with the specified content to the given URI. It is commonly used to submit data to a web service. Example usage:
Thrown when uri or content is null.
The method removes a previously added header, preventing it from being included in future requests. It is useful for managing dynamic header requirements. Example usage:
Returns: . A task representing the asynchronous operation, containing the HTTP response message.
The method allows sending an HTTP request with custom configurations and headers. It provides flexibility for executing different HTTP methods like PUT, DELETE, etc. Example usage:
Thrown when request is null.
The method allows adding a header that will be included in every HTTP request sent by the client service. This is useful for setting common headers like Authorization tokens or Content-Type. Example usage:
The to use for requests. This parameter is optional and defaults to null if not provided.
The method allows you to set a custom handler for the HTTP client, which can be used to configure specific behaviors like proxy settings, cookies, or custom authentication mechanisms. Example usage: