NewFuture.HttpClientObserver 0.1.4

dotnet add package NewFuture.HttpClientObserver --version 0.1.4
NuGet\Install-Package NewFuture.HttpClientObserver -Version 0.1.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NewFuture.HttpClientObserver" Version="0.1.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NewFuture.HttpClientObserver --version 0.1.4
#r "nuget: NewFuture.HttpClientObserver, 0.1.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 is true;
  • ignoreUris: ignore uri list in regex, default is the common urls in HttpClientObserver.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
0.1.4 128 9/14/2023
0.1.3 99 9/14/2023
0.1.2 84 9/14/2023
0.1.1 88 9/14/2023
0.1.0 114 9/14/2023
0.0.2 101 9/14/2023
0.0.1 98 9/14/2023