Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneResponse ¶ added in v0.3.0
CloneResponse makes an exact copy of a response WITHOUT closing the original response body.
func ReadRequestBody ¶ added in v0.2.0
ReadRequestBody reads the response.Body then replaces it with a new reader that can be read again by another process
func ReadResponseBody ¶ added in v0.2.0
ReadResponseBody reads the response.Body then replaces it with a new reader that can be read again by another process
This is inspired by several articles, including: https://blog.manugarri.com/how-to-reuse-http-response-body-in-golang-2/ https://medium.com/@xoen/golang-read-from-an-io-readwriter-without-loosing-its-content-2c6911805361
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a simple re-usable io.Reader. It stores the entire contents of another io.Reader in memory, so it should not be used with large files.
It implements the io.ReadCloser interface, along with a few other convenience methods.
This is inspired by several articles, including: https://blog.flexicondev.com/read-go-http-request-body-multiple-times
func NewReaderFromBytes ¶
NewReaderFromBytes creates a new Reader from the given slice of bytes