diff --git a/clone.go b/clone.go index 4fdd07c..ccbc7c6 100644 --- a/clone.go +++ b/clone.go @@ -2,7 +2,7 @@ package transport import "net/http" -// cloneRequest creates a shallow copy of a given request +// CloneRequest creates a shallow copy of a given request // to comply with stdlib's http.RoundTripper contract: // // RoundTrip should not modify the request, except for @@ -10,7 +10,7 @@ import "net/http" // read fields of the request in a separate goroutine. Callers // should not mutate or reuse the request until the Response's // Body has been closed. -func cloneRequest(orig *http.Request) *http.Request { +func CloneRequest(orig *http.Request) *http.Request { clone := &http.Request{} *clone = *orig diff --git a/logRequests.go b/logRequests.go index bf0b9d6..ac0e847 100644 --- a/logRequests.go +++ b/logRequests.go @@ -10,7 +10,7 @@ import ( func LogRequests(next http.RoundTripper) http.RoundTripper { return RoundTripFunc(func(req *http.Request) (resp *http.Response, err error) { - r := cloneRequest(req) + r := CloneRequest(req) curlCommand, _ := http2curl.GetCurlCommand(r) log.Printf("%v", curlCommand) diff --git a/setHeader.go b/setHeader.go index 7bf9592..ff967c1 100644 --- a/setHeader.go +++ b/setHeader.go @@ -7,7 +7,7 @@ import ( func SetHeader(header string, value string) func(http.RoundTripper) http.RoundTripper { return func(next http.RoundTripper) http.RoundTripper { return RoundTripFunc(func(req *http.Request) (resp *http.Response, err error) { - r := cloneRequest(req) + r := CloneRequest(req) r.Header.Set(http.CanonicalHeaderKey(header), value) diff --git a/setHeaderFunc.go b/setHeaderFunc.go index 489b2c8..18ca65a 100644 --- a/setHeaderFunc.go +++ b/setHeaderFunc.go @@ -7,7 +7,7 @@ import ( func SetHeaderFunc(header string, fn func(req *http.Request) string) func(http.RoundTripper) http.RoundTripper { return func(next http.RoundTripper) http.RoundTripper { return RoundTripFunc(func(req *http.Request) (resp *http.Response, err error) { - r := cloneRequest(req) + r := CloneRequest(req) r.Header.Set(http.CanonicalHeaderKey(header), fn(r))