diff --git a/stream.go b/stream.go index 377ff46..c7cb5a9 100644 --- a/stream.go +++ b/stream.go @@ -21,8 +21,11 @@ type StreamWriter func(w *bufio.Writer) // // The returned reader may be passed to Response.SetBodyStream. // +// Close must be called on the returned reader after after all the required data +// has been read. Otherwise goroutine leak may occur. +// // See also Response.SetBodyStreamWriter. -func NewStreamReader(sw StreamWriter) io.Reader { +func NewStreamReader(sw StreamWriter) io.ReadCloser { pr, pw := io.Pipe() var bw *bufio.Writer