fix: add copilot header to fix json error (#9456)

* add accept type in header

* add header
This commit is contained in:
beyondkmp 2025-08-23 18:59:29 +08:00 committed by GitHub
parent 3be7c2e1a8
commit d6866052c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,7 +68,11 @@ class CopilotService {
constructor() {
this.tokenFilePath = path.join(app.getPath('userData'), '.copilot_token')
this.headers = { ...CONFIG.DEFAULT_HEADERS }
this.headers = {
...CONFIG.DEFAULT_HEADERS,
accept: 'application/json',
'user-agent': 'Visual Studio Code (desktop)'
}
}
/**
@ -93,6 +97,7 @@ class CopilotService {
'Sec-Fetch-Site': 'none',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Dest': 'empty',
accept: 'application/json',
authorization: `token ${token}`
}
})