Click or drag to resize

HttpClientExtensionsGetStreamSafeAsync Method (HttpClient, String, ArgDictionary, LogActivity)

Sends a GET to a specified string URI and returns the response body as a Stream ensuring that the operation succeeded.

Namespace:  System.Net.Http
Assembly:  Neon.Common (in Neon.Common.dll) Version: 2.10.0
public static Task<Stream> GetStreamSafeAsync(
	this HttpClient client,
	string requestUri,
	ArgDictionary headers = null,
	LogActivity activity = null


Type: System.Net.HttpHttpClient
The client.
Type: SystemString
The request URI.
headers (Optional)
Type: Neon.CollectionsArgDictionary
Optional request headers.
activity (Optional)
Type: Neon.DiagnosticsLogActivity
Optional LogActivity whose ID is to be included in the request.

Return Value

Type: TaskStream
The response stream.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpClient. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
ArgumentNullExceptionThrown when a required argument is null.
SocketExceptionThrown for network connectivity issues.
HttpExceptionThrown when the server responds with an HTTP error status code.
See Also