[internal.http.reader] auto-correcting (no error raised)
This commit is contained in:
parent
ca472fb80c
commit
be8bfa012e
|
@ -6,7 +6,6 @@ package reader
|
||||||
// the golang standard library
|
// the golang standard library
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"bufio"
|
"bufio"
|
||||||
)
|
)
|
||||||
|
@ -22,14 +21,14 @@ type chunkReader struct {
|
||||||
|
|
||||||
|
|
||||||
// New creates a new reader
|
// New creates a new reader
|
||||||
func NewReader(r io.Reader) (reader *chunkReader, err error) {
|
func NewReader(r io.Reader) (reader *chunkReader) {
|
||||||
|
|
||||||
br, ok := r.(*bufio.Reader)
|
br, ok := r.(*bufio.Reader)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Invalid reader (must implement bufio.Reader")
|
br = bufio.NewReader(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &chunkReader{reader: br}, nil
|
return &chunkReader{reader: br}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue