# jarcoal/httpmock

HTTP mocking for Golang

Repository: https://github.com/jarcoal/httpmock
Canonical: https://ross.abutalabs.com/products/httpmock
Homepage: http://godoc.org/github.com/jarcoal/httpmock
Language: Go
License: MIT
License Family: permissive
Last push: 2026-08-20T17:40:04+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 98, release rhythm 63, longevity 100
- inputs: {"age_days": 4573, "days_push": 13, "days_rel": 36, "gap_med": 239.0, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2077, forks 107 (observed 2026-08-28T04:06:11.331040+00:00)

## What it is
httpmock is a Go library for easily mocking HTTP responses from external resources in tests. It lets you register responders for exact URLs or regex patterns and inspect call counts.

## Use cases
- mock external HTTP APIs in Go tests
- stub HTTP responses with exact URL or regexp matching
- count how many HTTP calls my code made during a test
- return fake JSON responses from an API client test
- test error handling for failed HTTP requests

## When to choose
- you write Go code that calls external HTTP APIs and want deterministic tests
- you need regexp-based URL matching and call-count assertions
- you want a lightweight, well-maintained MIT-licensed mocking library

## When to avoid
- you need to mock non-HTTP protocols like gRPC or databases
- you want contract testing against a real mock server
- your project is not written in Go

## Facets
- artifact type: library
- maturity: stable
- function: testing, mocking, http-client
- domain: testing, developer-tools, apis, backend
- platform: go, cross-platform
- tags: http-mocking, go-testing, unit-testing, http-responder, test-double

## Member repositories
- jarcoal/httpmock (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:11.331040+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-30T02:56:09.277997+00:00, confidence not recorded.
  - readme: https://github.com/jarcoal/httpmock (fetched 2026-08-28T04:06:11.331040+00:00, sha bc6002676583)
  - homepage: http://godoc.org/github.com/jarcoal/httpmock (fetched 2026-08-29T10:36:20.506145+00:00, sha c39958946e84)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T10:36:20.520453+00:00, sha 757852027879)
  - site_page: https://pkg.go.dev/github.com/jarcoal/httpmock (fetched 2026-08-29T10:36:20.516891+00:00, sha 6c46f5b10bbd)
  - site_page: https://go.dev/project (fetched 2026-08-29T10:36:20.522342+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
