mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-16 16:17:38 +03:00
Reset bodyStream when SetBody or ResetBody is called
This commit is contained in:
@@ -143,11 +143,13 @@ func (resp *Response) Body() []byte {
|
||||
|
||||
// SetBody sets response body.
|
||||
func (resp *Response) SetBody(body []byte) {
|
||||
resp.bodyStream = nil
|
||||
resp.body = append(resp.body[:0], body...)
|
||||
}
|
||||
|
||||
// ResetBody resets response body.
|
||||
func (resp *Response) ResetBody() {
|
||||
resp.bodyStream = nil
|
||||
resp.body = resp.body[:0]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user