Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseDetector ¶
type CloseDetector struct {
io.ReadCloser
// contains filtered or unexported fields
}
CloseDetector is an io.ReadCloser that tracks whether Close has been called. This struct is useful because the behavior of Close after the first call is undefined.
func NewCloseDetector ¶
func NewCloseDetector(rc io.ReadCloser) *CloseDetector
NewCloseDetector wraps an existing io.ReadCloser.
func NewCloseDetectorFromString ¶
func NewCloseDetectorFromString(s string) *CloseDetector
NewCloseDetectorFromString wraps a NopCloser containing the string
func (*CloseDetector) Close ¶
func (cd *CloseDetector) Close() error
Close delegates to the wrapped Close function and tracks whether the function was called.
func (*CloseDetector) IsClosed ¶
func (cd *CloseDetector) IsClosed() bool
IsClosed returns whether Close was called
type SpyServer ¶
type SpyServer struct {
Response *http.Response
Error error
// contains filtered or unexported fields
}
SpyServer implements the http.RoundTripper interface to serve a custom http.Response or error while capturing the request for later inspection A pointer to this type can be assigned to http.Client.Transport to override the default RoundTripper
func (*SpyServer) GetRequest ¶
GetRequest returns the http.Request that was passed during the last RoundTrip