MCPcopy Create free account
hub / github.com/prometheus/common / cloneRequest

Function cloneRequest

config/http_config.go:823–833  ·  view source on GitHub ↗

cloneRequest returns a clone of the provided *http.Request. The clone is a shallow copy of the struct and its Header map.

(r *http.Request)

Source from the content-addressed store, hash-verified

821// cloneRequest returns a clone of the provided *http.Request.
822// The clone is a shallow copy of the struct and its Header map.
823func cloneRequest(r *http.Request) *http.Request {
824 // Shallow copy of the struct.
825 r2 := new(http.Request)
826 *r2 = *r
827 // Deep copy of the Header.
828 r2.Header = make(http.Header)
829 for k, s := range r.Header {
830 r2.Header[k] = s
831 }
832 return r2
833}
834
835// NewTLSConfig creates a new tls.Config from the given TLSConfig.
836func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error) {

Callers 4

RoundTripMethod · 0.85
RoundTripMethod · 0.85
RoundTripMethod · 0.85
RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected