Skip to content

Instantly share code, notes, and snippets.

@csmith0651
Created May 25, 2016 12:59
Show Gist options
  • Save csmith0651/e1bcf3c6369c6c548214af83eb310bcb to your computer and use it in GitHub Desktop.
Save csmith0651/e1bcf3c6369c6c548214af83eb310bcb to your computer and use it in GitHub Desktop.
type MockBody struct {
buf *bytes.Buffer
}
func (m MockBody) Close() error {
return nil
}
func (m MockBody) Read(p []byte) (n int, err error) {
return m.buf.Read(p)
}
func NewMockBody(jsonBody []byte) *MockBody {
ret := MockBody{
buf: bytes.NewBuffer(jsonBody),
}
return &ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment