Skip to content

Commit

Permalink
Reduce allocation on LoadResponse headers
Browse files Browse the repository at this point in the history
  • Loading branch information
moredure authored and ysmood committed Aug 4, 2022
1 parent d51fc06 commit 4710d7f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hijack.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,11 @@ func (h *Hijack) LoadResponse(client *http.Client, loadBody bool) error {

h.Response.payload.ResponseCode = res.StatusCode

list := []string{}
for k, vs := range res.Header {
for _, v := range vs {
list = append(list, k, v)
h.Response.SetHeader(k, v)
}
}
h.Response.SetHeader(list...)

if loadBody {
b, err := ioutil.ReadAll(res.Body)
Expand Down

0 comments on commit 4710d7f

Please sign in to comment.