httptracer-preview - HttpTracer 2.0.2

A simple http tracing library to write request and response information to your output window. Making your life easier when debugging http calls!

PM> Install-Package HttpTracer -Version 2.0.2 -Source https://www.myget.org/F/httptracer-preview/api/v3/index.json

Copy to clipboard

> nuget.exe install HttpTracer -Version 2.0.2 -Source https://www.myget.org/F/httptracer-preview/api/v3/index.json

Copy to clipboard

> dotnet add package HttpTracer --version 2.0.2 --source https://www.myget.org/F/httptracer-preview/api/v3/index.json

Copy to clipboard
<PackageReference Include="HttpTracer" Version="2.0.2" />
Copy to clipboard
source https://www.myget.org/F/httptracer-preview/api/v3/index.json

nuget HttpTracer  ~> 2.0.2
Copy to clipboard

> choco install HttpTracer --version 2.0.2 --source https://www.myget.org/F/httptracer-preview/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "httptracer-preview" -SourceLocation "https://www.myget.org/F/httptracer-preview/api/v2"
Install-Module -Name "HttpTracer" -RequiredVersion "2.0.2" -Repository "httptracer-preview" 
Copy to clipboard

HttpTracer

A simple http tracing library to write request and response information to your output window. Making your life easier when debugging http calls!

Channel Status
Build Build status
MyGet.org #
NuGet.org #

Platform Support

Http Tracer is a .NET Standard 2.0 library.

Platform Version
Xamarin.iOS iOS 7+
Xamarin.Android API 14+
Windows 10 UWP 10.0.16299+
.NET Core 2.0+
ASP.NET Core 2.0+
.NET 4.6.1+

Getting Started

It is really easy to start using and debugging your Http requests, just add a instance of HttpTracerHandler to your HttpClient creation and start picking up the traces in your Visual Studio console window.

using HttpTracer;
public async Task GetMyData()
{
    var tracer = new HttpTracerHandler
    {
        Verbosity = HttpMessageParts.All
    };
    var client = new HttpClient(tracer);
    var result = await client.GetAsync("http://myserviceurl.com");
}

If you happen to use custom Http Handlers in your project, we suggest you use our Http handler builder:

using HttpTracer;
public async Task GetMyData()
{
    var builder = new HttpHandlerBuilder();

    builder.AddHandler(new MyHandler3())
           .AddHandler(new MyHandler2())
           .AddHandler(new MyHandler1());
           
    var tracer = builder.Build();
    tracer.Verbosity = HttpMessageParts.All;
    
    var client = new HttpClient(tracer);
    var result = await client.GetAsync("http://myserviceurl.com");
}

You can use bitwise operators to combine your desired HttpMessagePart options:

private const HttpMessageParts DefaultHttpTracerVerbosity =
            HttpMessageParts.RequestAll | HttpMessageParts.ResponseHeaders;

You can set the verbosity for all of your HttpTracerHandler instances by setting HttpTracerHandler.DefaultVerbosity. To set verbosity at the per-instance level, use HttpTracerHandler.Verbosity which will override HttpTracerHandler.DefaultVerbosity.

Replaying Requests

The output format for requests can be copy/pasted into a compatible rest client such as REST Client for Visual Studio Code or the REST Client which is part of JetBrains IDEs (Rider, PyCharm, Android Studio, etc).

License

Under MIT (see license file)

Want To Support This Project?

All we ask is to be active by submitting bugs, features, and sending those pull requests down!

  • .NETStandard 1.4
    • NETStandard.Library (>= 1.6.1)
  • .NETStandard 2.0
  • .NETStandard 1.4: 1.4.0.0
  • .NETStandard 2.0: 2.0.0.0

Owners

Dylan Berry

Authors

Dylan Berry, Daniel Causer, Chase Florell

Project URL

https://github.com/BSiLabs/HttpTracer

License

MIT

Tags

xamarin, windows, ios, android, http, tracing

Info

3 total downloads
3 downloads for version 2.0.2
Download (18.09 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.0.2 18.09 KB Tue, 30 Apr 2019 09:36:56 GMT 3
2.0.1 16.92 KB Tue, 23 Apr 2019 18:07:03 GMT 0
2.0.0 16.84 KB Mon, 22 Apr 2019 18:17:22 GMT 0