Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor by removing unnecessary else block #1559

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,8 @@ func decodeArgAppendNoPlus(dst, src []byte) []byte {
if idx < 0 {
// fast path: src doesn't contain encoded chars
return append(dst, src...)
} else {
dst = append(dst, src[:idx]...)
}
dst = append(dst, src[:idx]...)

// slow path
for i := idx; i < len(src); i++ {
Expand Down
19 changes: 9 additions & 10 deletions streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down