Registry / testing / h2non-gock-v1

h2non-gock-v1

JSON →
library1.1.2gogounverified

A Go HTTP mocking library for testing HTTP clients with easy-to-use interceptors.

go get gopkg.in/h2non/gock.v1
INSTALL
IMPORT
SIG · H2NON-GOCK-V1
H
h2non-gock-v1
testinggov1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gock
gopkg.in/h2non/gock.v1

Mock an HTTP GET request and verify the response.

package main import ( "fmt" "io/ioutil" "net/http" "gopkg.in/h2non/gock.v1" ) func main() { defer gock.Off() gock.New("http://example.com").Get("/foo").Reply(200).BodyString("bar") resp, _ := http.Get("http://example.com/foo") body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.1.2latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
h2non-gock-v1 — go get h2non-gock-v1 · libregistry