h2non/gock
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽ observed · 2026-08-28
Health v2 · maintenance only
23/100
- Activity 0
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 3836
- days_rel: n/a
- days_push: 708
- n_releases_24m: 0
Adoption not part of the score
2218 stars · 112 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
gock is a Go library for declarative HTTP traffic mocking that intercepts outgoing requests via http.RoundTripper and matches them against defined expectations. It offers a fluent DSL for stubbing responses with matching by method, URL, headers, and body, inspired by JavaScript's nock.
Use cases
- mock http responses in go tests
- stub external api calls in unit tests
- intercept net/http requests during testing
- simulate network timeouts and delays in go
- test http clients without hitting real servers
- mock api responses in go
When to choose
- you write Go tests that make outbound HTTP calls via net/http
- you want a nock-style fluent DSL for declaring HTTP expectations
- you need regex-based request matching or TTL-limited mocks
When to avoid
- you need to mock gRPC or non-HTTP protocols
- you prefer running a real mock server over in-process interception
- your project is not written in Go
Facets
library · maturity stable
mocking testing http-client testing developer-tools apis web-development go cross-platform http-mocking http-interceptor nock-inspired stubbing net-http roundtripper api-testing
4 sources
- readme: https://github.com/h2non/gock · fetched 2026-08-28 · 24a4bfae4c1c
- homepage: https://pkg.go.dev/github.com/h2non/gock · fetched 2026-08-29 · c57f404f6ee6
- site_page: https://pkg.go.dev/about · fetched 2026-08-29 · 757852027879
- site_page: https://go.dev/project · fetched 2026-08-29 · d5ca00bb378b
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| h2non/gock | main | 23 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem