NewFuture.HttpClientObserver
0.1.4
dotnet add package NewFuture.HttpClientObserver --version 0.1.4
NuGet\Install-Package NewFuture.HttpClientObserver -Version 0.1.4
<PackageReference Include="NewFuture.HttpClientObserver" Version="0.1.4" />
paket add NewFuture.HttpClientObserver --version 0.1.4
#r "nuget: NewFuture.HttpClientObserver, 0.1.4"
// Install NewFuture.HttpClientObserver as a Cake Addin
#addin nuget:?package=NewFuture.HttpClientObserver&version=0.1.4
// Install NewFuture.HttpClientObserver as a Cake Tool
#tool nuget:?package=NewFuture.HttpClientObserver&version=0.1.4
HttpClientObserver
Diagnose your Http out-bound traffic with one line of code NewFuture.HttpClientObserver.SubscribeAll()
.
It will log all HttpClient
requests into the Diagnostic Tools Events view window.
Highly recommend to use it in debug mode only with #if DEBUG
for performance and security reasons.
Installation
install with nuget
dotnet add package NewFuture.HttpClientObserver
Usage
For example, you can add it to Startup.cs
or Program.cs
to subscribe all HttpClient events.
Arguments
logResponseBody
: log response content, default istrue
;ignoreUris
: ignore uri list in regex, default is the common urls inHttpClientObserver.DefaultIgnoreUrlList
.
Examples
Basic usage
// in Startup.cs
#if DEBUG
// subscribe all HttpClient response in debug mode
NewFuture.HttpClientObserver.SubscribeAll();
#endif
Ignore some urls
// DefaultIgnoreUrlList contains some common urls, you can add your own
List<Regex> ignoreList = new(HttpClientObserver.DefaultIgnoreUrlList)
{
new Regex("http://localhost.*")
};
// ignore uri list in regex
NewFuture.HttpClientObserver.SubscribeAll(ignoreUris: ignoreList);
Don't log response body
NewFuture.HttpClientObserver.SubscribeAll(false);
compatible
Only tested in Windows .NET 6.0, but it should work in other versions.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.