3.52Enabling the Request Analysis Tool

Created on Aug 17, 2026~3 min read

Modern browsers usually have built-in developer tools that can capture and visually display all request and response data when a user visits a website. Similarly, we provide a set of analysis tools for the HTTP remote request module.

cs
HttpRequestBuilder.Get("https://furion.net")    .Profiler();    // or use Debugger()HttpRequestBuilder.Get("https://furion.net")    .Profiler(false);   // Disable the request analysis tool, or call any function: DisableProfiler(), DisableDebugger(), Debugger(false)// Get the request analysis tool's dataHttpRequestBuilder.Get("https://furion.net")    .Profiler(analyzer =>    {        Console.WriteLine(analyzer.Data);    });HttpRequestBuilder.Get("https://furion.net")    .Profiler(analyzer =>    {        Console.WriteLine(analyzer.Data);    }, false);  // Disable the request analysis tool

After enabling it, when an HTTP remote request is executed, the console will output the following detailed information:

bash
Request Headers:    User-Agent:      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0    X-Header:        customGeneral:    Request URL:               https://furion.net/    Request Method:            GET    Status Code:               200 OK    HTTP Version:              1.1    HTTP Content:    Content Type:    HttpClient Name:    Request Duration (ms):     149.00Response Headers:    Server:             nginx/1.22.1    Date:               Thu, 14 Nov 2024 15:35:41 GMT    Connection:         keep-alive    Vary:               Accept-Encoding    ETag:               "67091697-f32f"    Cache-Control:      max-age=315360000    Accept-Ranges:      bytes    Content-Type:       text/html    Content-Length:     62255    Last-Modified:      Fri, 11 Oct 2024 12:14:15 GMT    Expires:            Thu, 31 Dec 2037 23:55:55 GMT

In addition to enabling the analysis tool for a single request, you can also register it globally to enable it in HttpClient:

cs
// Enable for the default clientservices.AddHttpClient(string.Empty)    .AddProfilerDelegatingHandler();// You can also provide conditional disabling, for example disabling in productionservices.AddHttpClient(string.Empty)    .AddProfilerDelegatingHandler(disableIn: () => builder.Environment.EnvironmentName == "Production");services.AddHttpClient(string.Empty)    .AddProfilerDelegatingHandler(disableInProduction: true);// Enable for a specific client//services.AddHttpClient("weixin")//    .AddProfilerDelegatingHandler();// You can also enable it for all clients in one goservices.ConfigureHttpClientDefaults(clientBuilder =>    clientBuilder.AddProfilerDelegatingHandler());// Or use the IHttpRemoteBuilder extension method for one-click configurationservices.AddHttpRemote()    .ConfigureHttpClientDefaults(clientBuilder => clientBuilder.AddProfilerDelegatingHandler());

By enabling the request analysis tool, developers can observe and debug HTTP requests more intuitively and conveniently, thereby improving development efficiency and debugging accuracy.