- Notifications
You must be signed in to change notification settings - Fork929
fix: fix --header flag in CLI#8023
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -430,6 +427,15 @@ type RootCmd struct { | |||
} | |||
func addTelemetryHeader(client *codersdk.Client, inv *clibase.Invocation) { | |||
transport, ok := client.HTTPClient.Transport.(*headerTransport) | |||
if !ok { | |||
transport = &headerTransport{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm a bit worried about losing headers in a situation where we think it's safe to wrap the transport and we end up with a type that'sheaderTransport(otherTransport(headerTransport))
. Not sure what the best approach to guard against this would be, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yeah I'm unsure either but I don't think it will happen in practice, the addTelemetryHeader fn is called immediately after creating the client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Uh oh!
There was an error while loading.Please reload this page.
The
--header
flag was changed fromkey=value
tokey:value
in43eee35 which is a breaking change.This PR reverts the behavior to
key=value
as there doesn't seem to be a good reason for the breaking change.The
ExtraHeaders
field is removed fromcodersdk.Client
to match the prior behavior and to reduce the amount of ways headers can be set in the SDK to avoid confusion.This regression would've been caught by an existing test, but the test was faulty and didn't catch the issue. The test has been fixed and improved, and a test has been added to make sure headers are sent to the DERP server to avoid breaking#6572.
Fixes#8021
Fixeshttps://github.com/coder/v2-customers/issues/203