Skip to content

theypsilon/go-httpmock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httpmock.go Build Status

Simple utility, for mocking http connections. Work 90% based on this gist: https://gist.github.com/jarcoal/8940980

// 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")

About

Utility for mocking the net/http package of the Go language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages