fix: add global headers to `vscodessh` command (#7181)

This commit is contained in:
Kyle Carberry 2023-04-18 08:07:10 -05:00 committed by GitHub
parent 56bf9cfdbe
commit 693e5d94bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -27,7 +27,7 @@ import (
// This command needs to remain stable for compatibility with
// various VS Code versions, so it's kept separate from our
// standard SSH command.
func (*RootCmd) vscodeSSH() *clibase.Cmd {
func (r *RootCmd) vscodeSSH() *clibase.Cmd {
var (
sessionTokenFile string
urlFile string
@ -82,6 +82,12 @@ func (*RootCmd) vscodeSSH() *clibase.Cmd {
client := codersdk.New(serverURL)
client.SetSessionToken(string(sessionToken))
// This adds custom headers to the request!
err = r.setClient(client, serverURL)
if err != nil {
return xerrors.Errorf("set client: %w", err)
}
parts := strings.Split(inv.Args[0], "--")
if len(parts) < 3 {
return xerrors.Errorf("invalid argument format. must be: coder-vscode--<owner>-<name>-<agent?>")