mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
cli: add --debug-http flag (#7192)
This makes it easier to help debug client issues.
This commit is contained in:
+13
@@ -364,6 +364,13 @@ func (r *RootCmd) Command(subcommands []*clibase.Cmd) (*clibase.Cmd, error) {
|
||||
Value: clibase.BoolOf(&r.verbose),
|
||||
Group: globalGroup,
|
||||
},
|
||||
{
|
||||
Flag: "debug-http",
|
||||
Description: "Debug codersdk HTTP requests.",
|
||||
Value: clibase.BoolOf(&r.debugHTTP),
|
||||
Group: globalGroup,
|
||||
Hidden: true,
|
||||
},
|
||||
{
|
||||
Flag: config.FlagName,
|
||||
Env: "CODER_CONFIG_DIR",
|
||||
@@ -412,6 +419,7 @@ type RootCmd struct {
|
||||
forceTTY bool
|
||||
noOpen bool
|
||||
verbose bool
|
||||
debugHTTP bool
|
||||
|
||||
noVersionCheck bool
|
||||
noFeatureWarning bool
|
||||
@@ -464,6 +472,11 @@ func (r *RootCmd) InitClient(client *codersdk.Client) clibase.MiddlewareFunc {
|
||||
|
||||
client.SetSessionToken(r.token)
|
||||
|
||||
if r.debugHTTP {
|
||||
client.PlainLogger = os.Stderr
|
||||
client.LogBodies = true
|
||||
}
|
||||
|
||||
// We send these requests in parallel to minimize latency.
|
||||
var (
|
||||
versionErr = make(chan error)
|
||||
|
||||
Reference in New Issue
Block a user