MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / CopyToRequest

Function CopyToRequest

httpheaders/copy.go:48–61  ·  view source on GitHub ↗

CopyToRequest copies headers from the provided header to the http.Request.

(header http.Header, req *http.Request)

Source from the content-addressed store, hash-verified

46
47// CopyToRequest copies headers from the provided header to the http.Request.
48func CopyToRequest(header http.Header, req *http.Request) {
49 for key, values := range header {
50 if len(values) == 0 {
51 continue
52 }
53
54 // Keys in http.Header are already canonicalized, so no need for http.CanonicalHeaderKey here
55 if key == Host {
56 req.Host = values[0]
57 } else {
58 req.Header[key] = append([]string(nil), values...)
59 }
60 }
61}

Callers 2

BuildRequestMethod · 0.92
TestCopyToRequestFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestCopyToRequestFunction · 0.74