diff options
author | 2021-10-01 13:37:28 +0200 | |
---|---|---|
committer | 2021-10-01 13:38:31 +0200 | |
commit | ffab77a59d9ca1fe3add2f6501efd44a6669291b (patch) | |
tree | aaf7a9f715cd1f5f813f2efbae1479628a18e7bc /http.go | |
parent | Properly parse URI (diff) | |
download | fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.gz fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.tar.bz2 fasthttp-ffab77a59d9ca1fe3add2f6501efd44a6669291b.zip |
Improve return value reusability documentation
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -320,7 +320,9 @@ func (resp *Response) LocalAddr() net.Addr { // Body returns response body. // -// The returned body is valid until the response modification. +// The returned value is valid until the response is released, +// either though ReleaseResponse or your request handler returning. +// Do not store references to returned value. Make copies instead. func (resp *Response) Body() []byte { if resp.bodyStream != nil { bodyBuf := resp.bodyBuffer() @@ -638,7 +640,9 @@ func (req *Request) SwapBody(body []byte) []byte { // Body returns request body. // -// The returned body is valid until the request modification. +// The returned value is valid until the request is released, +// either though ReleaseRequest or your request handler returning. +// Do not store references to returned value. Make copies instead. func (req *Request) Body() []byte { if req.bodyRaw != nil { return req.bodyRaw |