Created
May 25, 2016 12:59
-
-
Save csmith0651/e1bcf3c6369c6c548214af83eb310bcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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