Fall back to alternate fetch implementation (#262181)

This commit is contained in:
Christof Marti
2025-08-19 13:46:22 +02:00
committed by GitHub
parent 3f44d80059
commit 5bf6e4d607
4 changed files with 383 additions and 13 deletions

View File

@@ -177,6 +177,8 @@ export class GitHubServer implements IGitHubServer {
try {
// Defined here: https://docs.github.com/en/rest/apps/oauth-applications?apiVersion=2022-11-28#delete-an-app-token
const result = await fetching(uri.toString(true), {
logger: this._logger,
expectJSON: false,
method: 'DELETE',
headers: {
Accept: 'application/vnd.github+json',
@@ -218,6 +220,8 @@ export class GitHubServer implements IGitHubServer {
try {
this._logger.info('Getting user info...');
result = await fetching(this.getServerUri('/user').toString(), {
logger: this._logger,
expectJSON: true,
headers: {
Authorization: `token ${token}`,
'User-Agent': `${vscode.env.appName} (${vscode.env.appHost})`
@@ -276,6 +280,8 @@ export class GitHubServer implements IGitHubServer {
try {
const result = await fetching('https://education.github.com/api/user', {
logger: this._logger,
expectJSON: true,
headers: {
Authorization: `token ${session.accessToken}`,
'faculty-check-preview': 'true',
@@ -316,6 +322,8 @@ export class GitHubServer implements IGitHubServer {
let version: string;
if (!isSupportedTarget(this._type, this._ghesUri)) {
const result = await fetching(this.getServerUri('/meta').toString(), {
logger: this._logger,
expectJSON: true,
headers: {
Authorization: `token ${token}`,
'User-Agent': `${vscode.env.appName} (${vscode.env.appHost})`