Skip to content

Commit f96a91e

Browse files
committed
fix: use api. subdomain for enterprise GitHub Copilot token URL
The enterprise copilot token URL was incorrectly using a path prefix (/api/copilot_internal/v2/token) which returns a 404. The correct pattern, consistent with how api.github.com works for github.com, is to use the api. subdomain: https://api.<host>/copilot_internal/v2/token Also restores correct use of the computed copilot_token_url variable so that the GITHUB_COPILOT_TOKEN_URL override still works. Fixes #7716
1 parent 3f52775 commit f96a91e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/goose/src/providers/githubcopilot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl GithubCopilotUrls {
8282
let base = format!("https://{}", host);
8383
let copilot_token_url = copilot_token_url
8484
.map(|u| u.trim_end_matches('/').to_string())
85-
.unwrap_or_else(|| format!("{}/api/copilot_internal/v2/token", base));
85+
.unwrap_or_else(|| format!("https://api.{}/copilot_internal/v2/token", host));
8686
Self {
8787
device_code_url: format!("{}/login/device/code", base),
8888
access_token_url: format!("{}/login/oauth/access_token", base),
@@ -777,7 +777,7 @@ mod tests {
777777
);
778778
assert_eq!(
779779
urls.copilot_token_url,
780-
"https://my-enterprise.ghe.com/api/copilot_internal/v2/token"
780+
"https://api.my-enterprise.ghe.com/copilot_internal/v2/token"
781781
);
782782
}
783783

0 commit comments

Comments
 (0)