mirror of
https://github.com/thegeeklab/drone-s3-sync.git
synced 2024-06-29 11:40:51 +02:00
32 lines
520 B
Go
32 lines
520 B
Go
// +build !go1.5
|
|
|
|
package request
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
func copyHTTPRequest(r *http.Request, body io.ReadCloser) *http.Request {
|
|
req := &http.Request{
|
|
URL: &url.URL{},
|
|
Header: http.Header{},
|
|
Close: r.Close,
|
|
Body: body,
|
|
Host: r.Host,
|
|
Method: r.Method,
|
|
Proto: r.Proto,
|
|
ContentLength: r.ContentLength,
|
|
}
|
|
|
|
*req.URL = *r.URL
|
|
for k, v := range r.Header {
|
|
for _, vv := range v {
|
|
req.Header.Add(k, vv)
|
|
}
|
|
}
|
|
|
|
return req
|
|
}
|