Class HttpConnection
Provides methods for making HTTP requests and handling responses.
Inherited Members
Namespace: Innovt.Core.Http
Assembly: Innovt.Core.dll
Syntax
public static class HttpConnection
Methods
| Edit this page View SourceDelete(Uri, string, NameValueCollection, int?)
Sends an HTTP DELETE request to the specified endpoint and retrieves detailed information about the request and response.
Declaration
public static HttpRequestDetail Delete(Uri endpoint, string dataToSend, NameValueCollection headerData = null, int? connectionTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
string | dataToSend | Optional data to send with the request. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
HttpRequestDetail | An HttpRequestDetail object containing request and response details. |
Get<T>(Uri, ISerializer, string, NameValueCollection, int?)
Sends an HTTP GET request to the specified endpoint, deserializes the response to the specified type, and returns the deserialized object.
Declaration
public static T Get<T>(Uri endpoint, ISerializer serializer, string dataToSend = null, NameValueCollection headerData = null, int? connectionTimeout = null) where T : class
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
ISerializer | serializer | An instance of the serializer to use for deserialization. |
string | dataToSend | Optional data to send with the request. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
T | The deserialized response of type |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize the response to. |
Exceptions
Type | Condition |
---|---|
HttpException | Thrown if the response status code is not OK or Created. |
Head(Uri, string, NameValueCollection, int?)
Sends an HTTP HEAD request to the specified endpoint and retrieves detailed information about the request and response.
Declaration
public static HttpRequestDetail Head(Uri endpoint, string dataToSend, NameValueCollection headerData = null, int? connectionTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
string | dataToSend | Optional data to send with the request. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
HttpRequestDetail | An HttpRequestDetail object containing request and response details. |
Post(Uri, string, NameValueCollection, int?)
Sends an HTTP POST request to the specified endpoint and retrieves detailed information about the request and response.
Declaration
public static HttpRequestDetail Post(Uri endpoint, string dataToSend, NameValueCollection headerData = null, int? connectionTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
string | dataToSend | The data to send with the request. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
HttpRequestDetail | An HttpRequestDetail object containing request and response details. |
Post<T>(Uri, string, ISerializer, NameValueCollection, int?)
Sends an HTTP POST request to the specified endpoint and retrieves the response, deserializing it to the specified type.
Declaration
public static T Post<T>(Uri endpoint, string dataToSend, ISerializer serializer, NameValueCollection headerData = null, int? connectionTimeout = null) where T : class
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
string | dataToSend | The data to send with the request. |
ISerializer | serializer | An instance of the serializer to use for deserialization. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
T | The deserialized response of type |
Type Parameters
Name | Description |
---|---|
T | The type to deserialize the response to. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the serializer is null. |
HttpException | Thrown if the response status code is not OK or Created. |
Put(Uri, string, NameValueCollection, int?)
Sends an HTTP PUT request to the specified endpoint and retrieves detailed information about the request and response.
Declaration
public static HttpRequestDetail Put(Uri endpoint, string dataToSend, NameValueCollection headerData = null, int? connectionTimeout = null)
Parameters
Type | Name | Description |
---|---|---|
Uri | endpoint | The URI of the HTTP endpoint. |
string | dataToSend | Optional data to send with the request. |
NameValueCollection | headerData | Optional headers to include in the request. |
int? | connectionTimeout | Optional connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
HttpRequestDetail | An HttpRequestDetail object containing request and response details. |