title | author | description | keywords | dev_langs | ||
---|---|---|---|---|---|---|
HttpHelper |
nmetulev |
HttpHelper is a Windows Community Toolkit helper class used to assist in common http and networking scenarios (outdated docs). |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, HttpHelper |
|
Warning
(This API is obsolete and has been removed. Please use System.Net.Http.HttpClient or Windows.Web.Http.HttpClient directly)
The HttpHelper (/dotnet/api/microsoft.toolkit.uwp.httphelper
) represents an HTTP request message including headers.
var request = new HttpHelperRequest(new Uri("URI"), HttpMethod.Post);
var response = await HttpHelper.Instance.SendRequestAsync(request);
Private request = New HttpHelperRequest(New Uri("URI"), HttpMethod.Post)
Private response = Await HttpHelper.Instance.SendRequestAsync(request)
The HttpHelper class has these properties.
Property | Type | Description |
---|---|---|
Instance | HttpHelper | Gets the instance of HTTPHelper exposed as singleton. |
The HttpHelper class has these methods. It also inherits from Object class.
Methods | Return Type | Description |
---|---|---|
GetInputStreamAsync(HttpHelperRequest, CancellationToken) | Task<HttpHelperResponse> | Process Http Request using instance of HttpClient |
SendRequestAsync(HttpHelperRequest, CancellationToken) | Task<HttpHelperResponse> | Takes an instance of HttpHelperRequest as a parameter and passes it to server. It turns server response as HttpHelperResponse |
ToString() | string | Returns a string that represents the current HttpHelper object |
The HttpHelper class exposes an instance of the class as a static property. It additionally has one method - SendRequestAsync. This method requires an instance of HttpHelperRequest as an input parameter and returns an instance of HttpHelperResponse
using (var request = new HttpHelperRequest(new Uri(twitterUrl), HttpMethod.Post))
{
using (var response = await HttpHelper.Instance.SendRequestAsync(request))
{
return await response.GetTextResultAsync();
}
}
Using request = New HttpHelperRequest(New Uri(twitterUrl), HttpMethod.Post)
Using response = Await HttpHelper.Instance.SendRequestAsync(request)
Return Await response.GetTextResultAsync()
End Using
End Using
Device family | Universal, 10.0.16299.0 or higher |
---|---|
Namespace | Microsoft.Toolkit.Uwp |
NuGet package | Microsoft.Toolkit.Uwp |
- HttpHelper source code (
https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/rel/7.1.0/Microsoft.Toolkit.Uwp/Helpers/HttpHelper/HttpHelper.cs
)