[]
Sends a GET request to the specified URI asynchronously.
Task<WebRequestResult> GetAsync(string requestUri)
Function GetAsync(requestUri As String) As Task(Of WebRequestResult)
| Type | Name | Description |
|---|---|---|
| string | requestUri | The URI to send the GET request to. |
| Type | Description |
|---|---|
| Task<WebRequestResult> | A Task<TResult> representing the asynchronous operation; when completed, its result is a WebRequestResult that describes the outcome of the web request. |
class WebHandler : IWebRequestHandler
{
public Task<WebRequestResult> GetAsync(string requestUri)
{
WebRequestResult result = new WebRequestResult
{
StatusCode = 200,
ResponseContent = new byte[] { }
};
return Task.FromResult(result);
}
}
IWebRequestHandler handler = new WebHandler();
WebRequestResult result = await handler.GetAsync("https://example.com/data");