You have access to the CHttp tool, a powerful command-line utility for sending HTTP requests and measuring performance. This skill provides guidance on how to effectively use CHttp for various HTTP operations.
CHttp is a .NET-based tool for sending HTTP requests with support for HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3. It can perform:
- Single HTTP requests
- Performance measurements and load testing
- Performance data comparison
- Cookie persistence across requests
- Kerberos authentication
- Request throttling
chttp [command] [options]--uri <URL>(or-u): The target URL (REQUIRED)
--http-version <1.0|1.1|2|3>(or-v): HTTP version to use [default: 3]--method <GET|POST|PUT|DELETE|HEAD|OPTIONS|CONNECT|TRACE>(or-m): HTTP method [default: GET]--header(or-h): Add headers as key:value pairs (can be used multiple times)- Example:
--header="Content-Type:application/json"
- Example:
--body(or-b): Request body or path to file containing the request body- Note: JSON strings must be saved to a file, not passed directly
--upload-throttle: Throttle upload speed in KB/s
--timeout(or-t): Timeout in seconds [default: 30]--no-redirects: Disable automatic redirect following--no-cert-validationor--no-certificate-validation: Skip certificate validation (useful for testing)--log <Normal|Quiet|Silent|Verbose>(or-l): Logging level [default: Verbose]- Quiet: Only summary
- Normal: Headers and summary
- Verbose: Headers, content, and summary
--output(or-o): Save response to file
--cookie-container: Path to file for sharing cookies across requests--kerberos-auth(or-k): Enable Kerberos authentication
chttp --http-version 2 --method GET --uri https://api.example.com/datachttp --http-version 2 --method POST --uri https://api.example.com/data --header="Content-Type:application/json" --body request.jsonchttp --http-version 2 --method GET --uri https://api.example.comchttp --http-version 2 --log Quiet --uri https://api.example.comMeasure performance by sending multiple requests with multiple concurrent clients.
chttp perf [options]--clients(or-c): Number of parallel clients [default: 20]--requestCount(or-n): Total number of requests [default: 100]--output(or-o): Save results to JSON file--shared-sockethandler: Use socket pooling for multiple connections--metrics: Publish metrics to gRPC OpenTelemetry endpoint
chttp perf --http-version 2 --uri https://api.example.com --clients 10 --requestCount 1000 --output results.json- Mean, Standard Deviation, Median, Min, Max latencies
- 95th percentile latency
- Throughput (B/s)
- Requests per second
- Distribution histogram
- HTTP status code breakdown
Compare two performance measurement files.
chttp diff --files session1.json --files session2.jsonThis shows session1 as baseline and differences in session2, using:
=for similar results in both sessions#for more results in baseline+for more results in comparison session
For CI/CD pipelines, use CHttpExec with .chttp files:
chttpexec tests/test.chttp# @name validation
# @clientsCount 10
# @requestCount 100
# @assert mean < 1s stddev < 0.5s requestSec >= 0 throughput > 0 successStatus == 100
GET https://{{baseUrl}}/echo HTTP/2
{{nextRequest}}
mean: Average latencystddev: Standard deviationerror: Error marginmedian: Median latencymin/max: Min/max latenciesthroughput: Data throughputrequestsec: Requests per secondpercentile95th: 95th percentile latencysuccessStatus: Count of successful responses
s: Secondsms: Millisecondsus: Microsecondsns: Nanoseconds
Use this skill when the user wants to:
- Send HTTP requests from the command line
- Test API endpoints
- Measure HTTP performance and latency
- Compare performance across different scenarios
- Load test a server with configurable concurrency
- Debug HTTP interactions with custom headers and timeouts
- Validate HTTP status codes and responses
- Test different HTTP versions (1.0, 1.1, 2, 3)
- Authenticate using Kerberos
- Manage cookies across multiple requests
- Analyze performance distributions and throughput
CHttp can be installed as:
- A .NET global tool:
dotnet tool install -g LaDeak.CHttp --prereleaseanddotnet tool install -g LaDeak.CHttpExec --prerelease - A standalone executable (from releases)
- A Visual Studio Code extension
For C# projects, use the MeasurementsSession API directly to embed performance measurement logic.
- Quick API Testing: Verify endpoint responses with different methods and headers
- Performance Baseline: Establish baseline performance metrics for an API
- Regression Testing: Compare current performance against baseline measurements
- Load Testing: Stress test endpoints with configurable concurrency
- HTTP Version Testing: Compare performance across different HTTP versions
- CI/CD Integration: Use CHttpExec for automated performance validation