v0.0.546 Fix ginext json-parse error when the bufferedReader was read beforehand
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m55s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m55s
This commit is contained in:
@@ -115,6 +115,9 @@ func (b *bufferedReadCloser) BufferedAll() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if err := b.Reset(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b.buffer, nil
|
||||
|
||||
case modeSourceFinished:
|
||||
@@ -131,10 +134,22 @@ func (b *bufferedReadCloser) BufferedAll() ([]byte, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Reset resets the buffer to the beginning of the buffer.
|
||||
// If the original source is partially read, we will finish reading it and fill our buffer
|
||||
func (b *bufferedReadCloser) Reset() error {
|
||||
switch b.mode {
|
||||
case modeSourceReading:
|
||||
fallthrough
|
||||
if b.off == 0 {
|
||||
return nil // nobody has read anything yet
|
||||
}
|
||||
err := b.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.mode = modeBufferReading
|
||||
b.off = 0
|
||||
return nil
|
||||
|
||||
case modeSourceFinished:
|
||||
err := b.Close()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user