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.