Lines Matching refs:httpmock

1httpmock [![Build Status](https://travis-ci.org/jarcoal/httpmock.png?branch=v1)](https://travis-ci…
16 import "github.com/jarcoal/httpmock"
20 populate your `go.mod` with the last httpmock release, now
21 …Version](https://img.shields.io/github/tag/jarcoal/httpmock.svg)](https://github.com/jarcoal/httpm…
30 go get github.com/jarcoal/httpmock
36 import "github.com/jarcoal/httpmock"
46 govendor fetch github.com/jarcoal/httpmock@v1
50 import "github.com/jarcoal/httpmock"
55 govendor fetch gopkg.in/jarcoal/httpmock.v1
59 import "gopkg.in/jarcoal/httpmock.v1"
68 httpmock.Activate()
69 defer httpmock.DeactivateAndReset()
72 httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles",
73 httpmock.NewStringResponder(200, `[{"id": 1, "name": "My Great Article"}]`))
75 // Regexp match (could use httpmock.RegisterRegexpResponder instead)
76 httpmock.RegisterResponder("GET", `=~^https://api\.mybiz\.com/articles/id/\d+\z`,
77 httpmock.NewStringResponder(200, `{"id": 1, "name": "My Great Article"}`))
83 httpmock.GetTotalCallCount()
86 info := httpmock.GetCallCountInfo()
96 httpmock.Activate()
97 defer httpmock.DeactivateAndReset()
103 httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles",
105 resp, err := httpmock.NewJsonResponse(200, articles)
107 return httpmock.NewStringResponse(500, ""), nil
114 httpmock.RegisterResponder("GET", `=~^https://api\.mybiz\.com/articles/id/(\d+)\z`,
117 id := httpmock.MustGetSubmatchAsUint(req, 1) // 1=first regexp submatch
118 return httpmock.NewJsonResponse(200, map[string]interface{}{
126 httpmock.RegisterResponder("POST", "https://api.mybiz.com/articles",
130 return httpmock.NewStringResponse(400, ""), nil
135 resp, err := httpmock.NewJsonResponse(200, article)
137 return httpmock.NewStringResponse(500, ""), nil
170 "github.com/jarcoal/httpmock"
175 httpmock.Activate()
180 httpmock.Reset()
184 httpmock.DeactivateAndReset()
192 "github.com/jarcoal/httpmock"
197 httpmock.RegisterResponder("GET", "https://api.mybiz.com/articles.json",
198 httpmock.NewStringResponder(200, `[{"id": 1, "name": "My Great Article"}]`))
211 "github.com/jarcoal/httpmock"
217 httpmock.ActivateNonDefault(resty.DefaultClient.GetClient())
222 httpmock.Reset()
226 httpmock.DeactivateAndReset()
234 "github.com/jarcoal/httpmock"
241 responder := httpmock.NewStringResponder(200, fixture)
243 httpmock.RegisterResponder("GET", fakeUrl, responder)