bosprimigenious commented on code in PR #894:
URL:
https://github.com/apache/hugegraph-toolchain/pull/894#discussion_r4527123384
##########
hugegraph-client-go/hgtransport/hgtransport.go:
##########
@@ -117,7 +117,7 @@ func (c *Client) Perform(req *http.Request)
(*http.Response, error) {
var dupReqBody *bytes.Buffer
if c.logger != nil && c.logger.RequestBodyEnabled() {
if req.Body != nil && req.Body != http.NoBody {
- dupReqBody = bytes.NewBuffer(make([]byte, 0,
int(req.ContentLength)))
+ dupReqBody = new(bytes.Buffer)
Review Comment:
Thanks for the suggestion. At `725859c`, positive `ContentLength` is bounded
to 1 MiB before `Grow(... + bytes.MinRead)`, while unknown or non-positive
lengths keep the empty buffer. This retains a bounded preallocation hint
without trusting arbitrary request lengths.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]