 | 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
Syntaxpublic static Task<Stream> GetStreamSafeAsync(
this HttpClient client,
string requestUri,
ArgDictionary headers = null,
LogActivity activity = null
)
<ExtensionAttribute>
Public Shared Function GetStreamSafeAsync (
client As HttpClient,
requestUri As String,
Optional headers As ArgDictionary = Nothing,
Optional activity As LogActivity = Nothing
) As Task(Of Stream)
public:
[ExtensionAttribute]
static Task<Stream^>^ GetStreamSafeAsync(
HttpClient^ client,
String^ requestUri,
ArgDictionary^ headers = nullptr,
LogActivity activity = nullptr
)
[<ExtensionAttribute>]
static member GetStreamSafeAsync :
client : HttpClient *
requestUri : string *
?headers : ArgDictionary *
?activity : LogActivity
(* Defaults:
let _headers = defaultArg headers null
let _activity = defaultArg activity null
*)
-> Task<Stream>
Parameters
- client
- Type: System.Net.HttpHttpClient
The client. - requestUri
- 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:
TaskStreamThe 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).
Exceptions
See Also