bsilabs / httptracer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Format output so calls can easily be copy/pasted into Rest Client: https://marketplace.visualstudio.com/items?itemName=humao.rest-client
If we await the base method on a get it is melting down. need to figure it out.
Let's figure out if it is worth to build an extension for VS to be able to dump information properly colored and formated.
In many scenarios, we might need to preprocess a string before logging it. This would be for things like removing bearer tokens from headers or truncating large content bodies.
This feature request is to give us access to that data before logging it.
I am trying to log the response time of each API call to an external tool. Since HttpTracer internally tracks response time using StopWatch, can we access/use this data?
Sup guys!
I am not sure if this is already possible, but I am not able to figure out if using the package I can make my JSON response appear as indented JSON, so that it's easier to read. Currently I have to
Which is a lot of steps, so it would be awesome if there was a way to just change the config so HttpTracer does that!
Making the log methods async void or some other form of FireAndForget
will increase log performance as it's not actually waiting for the deserializing of the string before the result is returned to the caller.
I love HTTPTracer and use it for my http clients, but if I'm using RESTSharp, how can I use HttpTracer?
RestSharp using var client = new RestClient(
instead of httpclient
Hey @DanielCauser, @dylanberry, @ChaseFlorell !
I was excited to add this package into my project when I saw you guys speak about it, but I am getting the following error:
NU1202: Package HttpTracer 1.0.3 is not compatible with portable45-net45+win8+wpa81 (.NETPortable,Version=v4.5,Profile=Profile111). Package HttpTracer 1.0.3 supports:
Is there a way to still add it somehow without changing the Target Framework?
Writing all request and response data can be a heavy operation. We need a mechanism to control verbosity on the fly.
[Flags]
public enum HttpMessageParts
{
Unknown = 0
None = 1,
RequestBody = 2,
RequestHeaders = 4,
RequestAll = RequestBody | RequestHeaders,
ResponseBody = 8,
ResponseHeaders = 16,
ResponseAll = ResponseBody | ResponseHeaders,
All = ResponseAll | RequestAll
}
public HttpMessageParts Verbosity { get; set; } = HttpMessageParts.RequestAll | HttpMessageParts.ResponseHeaders;
NOTE: we must validate this is not set to HttpMessageParts.Unknown
public static HttpMessageParts DefaultVerbosity { get; set; } = HttpMessageParts.Unknown;
The developer will need to ensure the HttpTracerHandler
instance is available in order to change the verbosity on the fly.
using HttpTracer;
public async Task GetMyData()
{
var tracer = new HttpTracerHandler();
tracer.Verbosity = HttpMessageParts.RequestHeaders | HttpMessageParts.ResponseHeaders;
var client = new HttpClient(tracer);
var result = await client.GetAsync("http://myserviceurl.com");
}
Hi!
I really like this project, could this be used for testing?
Is there any planned feature for saving requests and responses to disk? And then used that saved data to replay the request, for testing purpose?
HttpClient not returning data, logging response or throwing exception.
Tested on iOS iPhone X 11.3 Simulator
const string url = "https://www.meetup.com/TorontoMobileDevelopers/events/rss/";
using (var client = new HttpClient(new TestHttpTracer.HttpTracerHandler()))
{
var result = await client.GetStringAsync(url).ConfigureAwait(false);
}
Result is null, but should match the response from the url as seen via the browser.
HttpClient returns data and logs response.
HttpClient returns null and does not log or throw an exception.
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.5.1 (build 22)
Installation UUID: d5d95059-9c23-453f-ab75-c9e751d1512f
Runtime:
Mono 5.10.1.47 (2017-12/8eb8f7d5e74) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)
Package version: 510010047
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.5
2.0.0-preview2-25407-01
1.1.2
1.0.5
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
SDK Versions:
2.1.4
2.0.0-preview2-006497
1.0.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.2
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 9.3.1 (14154.1)
Build 9E501
=== Xamarin.Mac ===
Version: 4.4.1.178 (Visual Studio Enterprise)
=== Xamarin.Android ===
Version: 8.3.0.19 (Visual Studio Enterprise)
Android SDK: /Users/dylanberry/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3
Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin.iOS ===
Version: 11.10.1.178 (Visual Studio Enterprise)
Hash: 408d3574
Branch: d15-7
Build date: 2018-05-08 18:56:30-0400
=== Xamarin Inspector ===
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 705010022
Git revision: 60442dd643a20c7a4ae1f8705b8d1de8972eee78
Build date: 2018-05-15 01:43:39+00
Xamarin addins: 4194ffe4868321e4c3477bd56aed579bda4c6fbb
=== Operating System ===
Mac OS X 10.13.4
Darwin 17.5.0 Darwin Kernel Version 17.5.0
Mon Mar 5 22:24:32 PST 2018
root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
MFractor 3.05.12
Internet of Things (IoT) development (Preview) 7.5
=====HTTP RESPONSE: [SUCCESS: 201]=====
or
=====HTTP RESPONSE: [FAILED: 500]=====
We need a fake HttpClient to ensure we can reliably run unit tests.
Preferences such as:
Due to the fact that the constructor always sets the InnerHandler the HttpTracerHandler
wont play nice with HttpClientBuilder.AddHttpMessageHandler<>()
method.
A constructor overload or options allow the HttpTracerHandler to be construct with the InnerHandler not being set would fix this.
Hey guys, we should think of making this lib multi target other versions of the net framework.
Separate lib and tests to a different solution. Only build what is necessary.
Hi there, I found your library in the course of trying to troubleshoot a Refit issue. It's one of those cases where I can make it work in Postman, but I'm not sure how to reproduce it correctly for Refit. The issue is I'm not seeing any trace output in the Debug window when I run my project. I've made a little walkthrough:
https://1drv.ms/u/s!AvguHRnyJtWMmeh7C8wHrd7X8BbDyA?e=tcCcNZ
Here's my relevant code:
https://github.com/adamfoneil/GitHubApi/blob/master/MicropubApi.Library/MicropubApiClient.cs#L17
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.