Skip to content

fix: add global headers to vscodessh command #7181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cli/vscodessh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?>")
Expand Down