# richardszalay/mockhttp

Testing layer for Microsoft's HttpClient library. Create canned responses using a fluent API.

Repository: https://github.com/richardszalay/mockhttp
Canonical: https://ross.abutalabs.com/products/mockhttp
Language: C#
License: MIT
License Family: permissive
Topics: dotnet, httpclient, testing, mocking, dotnetcore
Last push: 2026-08-08T02:10:36+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 64, longevity 100
- inputs: {"age_days": 4455, "days_push": 26, "days_rel": 26, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1760, forks 90 (observed 2026-08-28T04:05:32.616050+00:00)

## What it is
A testing library for .NET that replaces HttpClient's HttpMessageHandler with a mock handler, letting you configure canned responses via a fluent API. It supports both repeatable backend definitions and ordered one-shot request expectations, inspired by AngularJS's $httpBackend.

## Use cases
- mock http responses in unit tests
- test a service layer without network calls
- stub HttpClient requests with canned JSON
- verify expected HTTP requests were made
- simulate API responses in dotnet tests

## When to choose
- you use HttpClient in .NET and need deterministic offline tests
- you want fluent request matching with URL, method, and content constraints
- you need expectation-based verification of call order and counts

## When to avoid
- you need to mock non-.NET HTTP clients
- you want full integration tests against a real or spun-up HTTP server
- your tests target other HTTP stacks like RestSharp

## Facets
- artifact type: library
- maturity: active
- function: mocking, testing, http-client
- domain: testing, developer-tools, apis
- platform: dotnet, cross-platform
- tags: httpclient, unit-testing, fluent-api, stubbing, http-message-handler

## Member repositories
- richardszalay/mockhttp (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:32.616050+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:27:14.969721+00:00, confidence not recorded.
  - readme: https://github.com/richardszalay/mockhttp (fetched 2026-08-28T04:05:32.616050+00:00, sha fe4049307b3c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
