(req *http.Request, id, secret string)
| 1888 | } |
| 1889 | |
| 1890 | func 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 | /* |
| 1908 | UnauthenticatedRateLimitedTransport allows you to make unauthenticated calls |
no outgoing calls
searching dependent graphs…