MCPcopy Index your code
hub / github.com/docker/docker-agent / SetIdentity

Function SetIdentity

pkg/useragent/useragent.go:29–35  ·  view source on GitHub ↗

SetIdentity stamps the request with User-Agent, X-Docker-Agent-Version, and (when Docker Desktop is reachable) X-Docker-Desktop-Version. Callers that want operator-supplied overrides should apply those headers AFTER calling SetIdentity.

(req *http.Request)

Source from the content-addressed store, hash-verified

27// that want operator-supplied overrides should apply those headers AFTER
28// calling SetIdentity.
29func SetIdentity(req *http.Request) {
30 req.Header.Set("User-Agent", Header)
31 req.Header.Set(HeaderAgentVersion, version.Version)
32 if v := desktop.GetVersion(req.Context()); v != "" {
33 req.Header.Set(HeaderDesktopVersion, v)
34 }
35}

Callers 5

fetchURLMethod · 0.92
fetchRobotsMethod · 0.92
setHeadersFunction · 0.92
setHeadersFunction · 0.92
TestSetIdentityFunction · 0.85

Calls 3

GetVersionFunction · 0.92
ContextMethod · 0.80
SetMethod · 0.45

Tested by 1

TestSetIdentityFunction · 0.68