aboutsummaryrefslogtreecommitdiff
path: root/streaming.go
diff options
context:
space:
mode:
authorGravatar Oleksandr Redko <Oleksandr_Redko@epam.com> 2023-05-11 11:01:44 +0300
committerGravatar GitHub <noreply@github.com> 2023-05-11 10:01:44 +0200
commiteaab8ffc39764e3d1d021ec97d71d75387739cfa (patch)
tree8b14c92004c9fc4b2ecbea519d6e97b2265448bc /streaming.go
parentupdate go.sum (#1555) (diff)
downloadfasthttp-eaab8ffc39764e3d1d021ec97d71d75387739cfa.tar.gz
fasthttp-eaab8ffc39764e3d1d021ec97d71d75387739cfa.tar.bz2
fasthttp-eaab8ffc39764e3d1d021ec97d71d75387739cfa.zip
Refactor by removing unnecessary else block (#1559)
Diffstat (limited to 'streaming.go')
-rw-r--r--streaming.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/streaming.go b/streaming.go
index a0a374b..119560a 100644
--- a/streaming.go
+++ b/streaming.go
@@ -72,16 +72,15 @@ func (rs *requestStream) Read(p []byte) (int, error) {
return n, io.EOF
}
return n, err
- } else {
- left := rs.header.ContentLength() - rs.totalBytesRead
- if len(p) > left {
- p = p[:left]
- }
- n, err = rs.reader.Read(p)
- rs.totalBytesRead += n
- if err != nil {
- return n, err
- }
+ }
+ left := rs.header.ContentLength() - rs.totalBytesRead
+ if len(p) > left {
+ p = p[:left]
+ }
+ n, err = rs.reader.Read(p)
+ rs.totalBytesRead += n
+ if err != nil {
+ return n, err
}
if rs.totalBytesRead == rs.header.ContentLength() {