MCPcopy Index your code
hub / github.com/google/go-github / setCredentialsAsHeaders

Function setCredentialsAsHeaders

github/github.go:1890–1905  ·  view source on GitHub ↗
(req *http.Request, id, secret string)

Source from the content-addressed store, hash-verified

1888}
1889
1890func setCredentialsAsHeaders(req *http.Request, id, secret string) *http.Request {
1891 // To set extra headers, we must make a copy of the Request so
1892 // that we don't modify the Request we were given. This is required by the
1893 // specification of http.RoundTripper.
1894 //
1895 // Since we are going to modify only req.Header here, we only need a deep copy
1896 // of req.Header.
1897 convertedRequest := *req
1898 convertedRequest.Header = make(http.Header, len(req.Header))
1899
1900 for k, s := range req.Header {
1901 convertedRequest.Header[k] = append([]string(nil), s...)
1902 }
1903 convertedRequest.SetBasicAuth(id, secret)
1904 return &convertedRequest
1905}
1906
1907/*
1908UnauthenticatedRateLimitedTransport allows you to make unauthenticated calls

Callers 3

RoundTripMethod · 0.85
RoundTripMethod · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…