| 62 | } |
| 63 | |
| 64 | func (ct *capiTransport) RoundTrip(req *http.Request) (*http.Response, error) { |
| 65 | req.Header.Set("Authorization", "Bearer "+ct.token) |
| 66 | |
| 67 | // Since this RoundTrip is reused for both Copilot API and |
| 68 | // GitHub API requests, we conditionally add the integration |
| 69 | // ID only when performing requests to the Copilot API. |
| 70 | if req.URL.Host == ct.capiHost { |
| 71 | req.Header.Add("Copilot-Integration-Id", "copilot-4-cli") |
| 72 | |
| 73 | // Ensure we are not using GitHub API versions while targeting CAPI. |
| 74 | req.Header.Set("X-GitHub-Api-Version", "2026-01-09") |
| 75 | } |
| 76 | return ct.rp.RoundTrip(req) |
| 77 | } |