So I have the following code (some part is truncated) is it unnecessary step to copy the fasthttp response first instead of returning the res
object directly? If I directly return it should I put the ReleaseRequest()
outside (inside the calling function)?
func SendHttp(request interface{}) (result *fasthttp.Response, err error) {
c := config.NewFastHttpClient()
result = new(fasthttp.Response)
req := fasthttp.AcquireRequest()
res := fasthttp.AcquireResponse()
defer fasthttp.ReleaseRequest(req)
defer fasthttp.ReleaseResponse(res)
res.CopyTo(result)
return result, nil
}