https://github.com/theypsilon/go-httpmock
Utility for mocking the net/http package of the Go language
https://github.com/theypsilon/go-httpmock
Last synced: 9 months ago
JSON representation
Utility for mocking the net/http package of the Go language
- Host: GitHub
- URL: https://github.com/theypsilon/go-httpmock
- Owner: theypsilon
- License: bsl-1.0
- Created: 2014-12-27T05:49:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-27T06:26:00.000Z (over 11 years ago)
- Last Synced: 2025-02-01T11:30:19.732Z (over 1 year ago)
- Language: Go
- Size: 137 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_1_0.txt
Awesome Lists containing this project
README
httpmock.go 
======
Simple utility, for mocking http connections. Work 90% based on this gist: https://gist.github.com/jarcoal/8940980
```go
// in a gopkg.in/check.v1 test method:
RegisterResponder("GET", "http://example.com/", func(*http.Request) (*http.Response, error) {
return GetResponseWithBody("xin chao"), nil
})
response, _ := http.Get("http://example.com/")
c.Assert(BodyToString(response), checker.Equals, "xin chao")
```