Devlead.Testing.MockHttp.Tool
2026.10.15.1037
Prefix Reserved
dotnet tool install --global Devlead.Testing.MockHttp.Tool --version 2026.10.15.1037
dotnet new tool-manifest
dotnet tool install --local Devlead.Testing.MockHttp.Tool --version 2026.10.15.1037
#tool dotnet:?package=Devlead.Testing.MockHttp.Tool&version=2026.10.15.1037
nuke :add-package Devlead.Testing.MockHttp.Tool --version 2026.10.15.1037
Devlead.Testing.MockHttp.Tool
.NET global tool that hosts a Routes.json file and response resources as a local mock HTTP API.
Installation
dotnet tool install -g Devlead.Testing.MockHttp.Tool
Usage
dotnet mockhttp serve <RESOURCES> [--port 5080] [--url http://127.0.0.1:5080] [--match-host]
serve is the default command, so <RESOURCES> can be passed directly.
<RESOURCES>is a directory that containsRoutes.jsonand the response files it references.--portbindshttp://127.0.0.1:<port>(default 5080).--urloverrides--portand uses the URL authority only.--match-hostrequires the requestHostto match the host in each routeAbsoluteUri. By default only HTTP method, path, and query are matched so a client can use the mock as itsBaseAddress.
Point an HttpClient at the listen URL:
dotnet mockhttp serve ./Resources --port 5080
var client = new HttpClient { BaseAddress = new Uri("http://127.0.0.1:5080") };
var response = await client.GetAsync("/index.txt");
curl http://127.0.0.1:5080/index.txt
curl -i -H "Authorization: Bearer AccessToken" http://127.0.0.1:5080/login/secret.json
Those requests match Routes.json entries whose AbsoluteUri values are https://example.com/index.txt and https://example.com/login/secret.json.
While the host is running, the console shows a live table of configured routes and recent requests. Open http://127.0.0.1:5080/inspect for the inspect page: route enable/disable, request activity, and DevTools-style request/response headers and bodies. GET /inspect/api returns the same snapshot as JSON.
Routes.json and resources
The JSON contract is the same as Devlead.Testing.MockHttp: methods, AbsoluteUri, optional authorization, request-header-specific responses, status codes, and EnableRequests / DisableRequests.
ContentResource values such as Example.Login.Secret.json resolve to Example/Login/Secret.json under the resources directory.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.10.15.1037 | 67 | 10/15/2026 |
| 2026.10.14.1034 | 47 | 10/14/2026 |
| 2026.10.14.1026 | 48 | 10/14/2026 |
| 2026.10.14.1023 | 37 | 10/14/2026 |