Skip to content
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

Cody VSCE: Fix customHeaders never being passed through #54354

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

toolmantim
Copy link
Contributor

This fixes cody.customHeaders so it's used instead of ignored. Reported by an Enterprise user who can no longer log into their instance, because the custom header isn't being passed.

After:

--> POST /.api/graphql?CurrentUser HTTP/1.1
--> Content-Type: application/json; charset=utf-8
--> Authorization: token a test token
--> Accept: */*
--> Content-Length: 89
--> User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)
--> Accept-Encoding: gzip,deflate
--> Connection: close
--> Host: localhost:3000

Before:

--> POST /.api/graphql?CurrentUser HTTP/1.1
--> x-test: test-test-test
--> Content-Type: application/json; charset=utf-8
--> Authorization: token a test token
--> Accept: */*
--> Content-Length: 89
--> User-Agent: node-fetch/1.0 (+https://github.com/bitinn/node-fetch)
--> Accept-Encoding: gzip,deflate
--> Connection: close
--> Host: localhost:3000

Test plan

  • Set a custom header
  • Run a local echo server (npx http-echo-server 3000)
  • Sign in to server and observe headers
  • Debug in VS Code and observe headers

@toolmantim toolmantim requested a review from a team June 28, 2023 10:38
@cla-bot cla-bot bot added the cla-signed label Jun 28, 2023
@@ -188,7 +188,7 @@ export class AuthProvider {
public async auth(
uri: string,
token: string | null,
customHeaders = {}
customHeaders?: {} | null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes customerHeaders always being truthy, which caused this line to never use this.config.customHeaders:

customHeaders: customHeaders || this.config.customHeaders,

@sourcegraph-bot
Copy link
Contributor

📖 Storybook live preview

@toolmantim toolmantim merged commit 36aa49f into main Jun 28, 2023
23 checks passed
@toolmantim toolmantim deleted the tl/cody-vsce-fix-custom-headers branch June 28, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants