Skip to content

Commit

Permalink
Trim the slice returned by the brotli encoder
Browse files Browse the repository at this point in the history
bytes.Buffer can over-allocate; clone the slice so that it uses its minimum possible memory footprint
  • Loading branch information
CAFxX authored Aug 14, 2024
1 parent e32e0d3 commit d6adc2c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion brotli/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func AddEncoding(server *statigz.Server) {
return nil, err
}

return res.Bytes(), nil
return append([]byte{}, res.Bytes()...), nil
},
}

Expand Down

0 comments on commit d6adc2c

Please sign in to comment.