Skip to content

Commit

Permalink
Merge pull request #14 from jsternberg/master
Browse files Browse the repository at this point in the history
Discard io.EOF when more than 0 bytes have been read
  • Loading branch information
philhofer authored Jun 16, 2017
2 parents 98c11a7 + 2eb7ce4 commit 1612a29
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func (r *Reader) more() {
if a == 0 && r.state == nil {
r.state = io.ErrNoProgress
return
} else if a > 0 && r.state == io.EOF {
// discard the io.EOF if we read more than 0 bytes.
// the next call to Read should return io.EOF again.
r.state = nil
}
r.data = r.data[:len(r.data)+a]
}
Expand Down

0 comments on commit 1612a29

Please sign in to comment.