Commit 5bbb854c authored by Gyu-Ho Lee's avatar Gyu-Ho Lee Committed by Brad Fitzpatrick

net/http/httputil: preallocate trailerKeys slice

To prevent slice growths with append operations.

Change-Id: Icdb745b23cc44dfaf3e16746b94c06997f814e15
Reviewed-on: https://go-review.googlesource.com/23784Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 4383e438
......@@ -221,7 +221,7 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
// The "Trailer" header isn't included in the Transport's response,
// at least for *http.Transport. Build it up from Trailer.
if len(res.Trailer) > 0 {
var trailerKeys []string
trailerKeys := make([]string, 0, len(res.Trailer))
for k := range res.Trailer {
trailerKeys = append(trailerKeys, k)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment