func (req *Request) SwapBody(body []byte) []byte {
	bb := req.bodyBuffer()

	if req.bodyStream != nil {
		bb.Reset()
		_, err := copyZeroAlloc(bb, req.bodyStream)
		req.closeBodyStream()
		if err != nil {
			bb.Reset()
			bb.SetString(err.Error())
		}
	}

	oldBody := bb.B
	bb.B = body
	return oldBody
}
func (req *Request) SwapBody(body []byte) []byte {
	bb := req.bodyBuffer()

	if req.bodyStream != nil {
		bb.Reset()
		_, err := copyZeroAlloc(bb, req.bodyStream)
		req.closeBodyStream()
		if err != nil {
			bb.Reset()
			bb.SetString(err.Error())
		}
	}

	oldBody := bb.B
	bb.B = body
	return oldBody
}
func ( req * Request ) SwapBody ( body [ ] byte ) [ ] byte { bb := req . bodyBuffer ( ) if req . bodyStream != nil { bb . Reset ( ) _ , err := copyZeroAlloc ( bb , req . bodyStream ) req . closeBodyStream ( ) if err != nil { bb . Reset ( ) bb . SetString ( err . Error ( ) ) } } oldBody := bb . B bb . B = body return oldBody }
// SwapBody swaps request body with the given body and returns
// the previous request body.
//
// It is forbidden to use the body passed to SwapBody after
// the function returns.
SwapBody swaps request body with the given body and returns the previous request body . It is forbidden to use the body passed to SwapBody after the function returns .