Skip to content

Commit

Permalink
copy response body in fasthttp transport
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Jan 25, 2024
1 parent 4c76cc1 commit 31295cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rpc/http/fasthttp/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func (trans *Transport) Transport(ctx context.Context, request []byte) (response
if !trans.DisableHTTPHeader {
clientContext.Items().Set("httpResponseHeaders", getResponseHeader(&resp.Header))
}
return resp.SwapBody(nil), nil
body := resp.Body()
response := make([]byte, len(body))
copy(response, body)
return response, nil
case fasthttp.StatusRequestEntityTooLarge:
return nil, core.ErrRequestEntityTooLarge
default:
Expand Down

0 comments on commit 31295cc

Please sign in to comment.