Closed saamerm closed 3 years ago
you should be able to just copy the http request/response without additional debug info. Does your output not look like this?
INFO: ==================== HTTP REQUEST: [POST] ====================
POST https://xxx.azurewebsites.net/api/entityChangesList
Authorization: Bearer aeiod
client-version: 1.0.0
{"some","value"}
INFO: ==================== HTTP RESPONSE: [SUCCEEDED: 200 OK] ====================
POST https://xxx.azurewebsites.net/api/entityChangesList
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
Request-Context: appId=cid-v1:f8caa0cc-5524-4232-86b3-8aad02b0ae0b
Access-Control-Expose-Headers: Request-Context
X-Powered-By: ASP.NET
Date: Sun, 01 Mar 2020 16:53:03 GMT
Content-Length: 122
Content-Type: application/json; charset=utf-8
}
["some","response"]
Hey thanks for the quick reply!
It appears like this
But I was wondering if i can make it look like this:
(Obviously uncollapsed, collapsing was just done to hide the data)
So, we purposely print it on a single line, but your output still doesn't look quite right. What is your log level?
using HttpTracer;
public async Task GetMyData()
{
var tracer = new HttpTracerHandler();
tracer.Verbosity = LogLevel.Information; // this line here
var client = new HttpClient(tracer);
var result = await client.GetAsync("http://myserviceurl.com");
}
It's just set to Default using this line tracer.Verbosity = HttpTracerHandler.DefaultVerbosity;
It's separate, but I wasn't able to get access to LogLevel, do I use Splat?
you don't need splat. Try updating your "MessageParts" to All and see if it yields better results.
Hmm.. I tried that.
I'm talking about something shown here, like:
Console.WriteLine(JsonConvert.SerializeObject(jsonString, Formatting.Indented));
That would be a good feature for sure. Probably want to stick it behind an enum configuration value.
Happy to take a pull request đŸ˜‰
Sure! Any quick tips to what files I would be changing?
Take a look at the MessageParts and do the same. Values should be something like.
None = 1<<0, //default IndentRequest = 1<<1, IndentResponse = 1<<2, IndentAll = IndentRequest|IndentResponse
Enum name could be something like OutputFormatting
But, feel free to think of something better. NamingIsHardâ„¢
@saamerm I am trying to get this feature through as a part of #51
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
Copy the response I get:
Paste it into VS Code,
Remove the Debug stuff in the beginning of the lines that come after the first line
Remove the line breaks and put all of the response in one line
Then paste it into https://jsonformatter.curiousconcept.com/ and click "Process"
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!