diff --git a/http.go b/http.go index 8908aa0..d8cfc1f 100644 --- a/http.go +++ b/http.go @@ -157,12 +157,13 @@ func (req *Request) CopyTo(dst *Request) { dst.Reset() req.Header.CopyTo(&dst.Header) dst.body = append(dst.body[:0], req.body...) - if req.parsedURI { - dst.parseURI() - } - if req.parsedPostArgs { - dst.parsePostArgs() - } + + req.uri.CopyTo(&dst.uri) + dst.parsedURI = req.parsedURI + + req.postArgs.CopyTo(&dst.postArgs) + dst.parsedPostArgs = req.parsedPostArgs + // do not copy multipartForm - it will be automatically // re-created on the first call to MultipartForm. } diff --git a/uri.go b/uri.go index 12b310e..3e733cd 100644 --- a/uri.go +++ b/uri.go @@ -28,6 +28,7 @@ type URI struct { // CopyTo copies uri contents to dst. func (x *URI) CopyTo(dst *URI) { + dst.Reset() dst.pathOriginal = append(dst.pathOriginal[:0], x.pathOriginal...) dst.scheme = append(dst.scheme[:0], x.scheme...) dst.path = append(dst.path[:0], x.path...)