Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(agent): remove unused token debug handler#12602

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

Merged
johnstcn merged 1 commit intomainfromcj/agent-rm-unused-debug-handler
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
13 changes: 0 additions & 13 deletionsagent/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1714,18 +1714,6 @@ func (a *agent) HandleHTTPDebugManifest(w http.ResponseWriter, r *http.Request)
}
}

func (a *agent) HandleHTTPDebugToken(w http.ResponseWriter, r *http.Request) {
tok := a.sessionToken.Load()
if tok == nil {
a.logger.Error(r.Context(), "no session token in-memory")
w.WriteHeader(http.StatusInternalServerError)
_, _ = fmt.Fprintf(w, "no session token in-memory")
return
}
w.WriteHeader(http.StatusOK)
_, _ = fmt.Fprintf(w, *tok)
}

func (a *agent) HandleHTTPDebugLogs(w http.ResponseWriter, r *http.Request) {
logPath := filepath.Join(a.logDir, "coder-agent.log")
f, err := os.Open(logPath)
Expand DownExpand Up@@ -1753,7 +1741,6 @@ func (a *agent) HTTPDebug() http.Handler {
r.Get("/debug/magicsock", a.HandleHTTPDebugMagicsock)
r.Get("/debug/magicsock/debug-logging/{state}", a.HandleHTTPMagicsockDebugLoggingState)
r.Get("/debug/manifest", a.HandleHTTPDebugManifest)
r.Get("/debug/token", a.HandleHTTPDebugToken)
r.NotFound(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
_, _ = w.Write([]byte("404 not found"))
Expand Down
16 changes: 0 additions & 16 deletionsagent/agent_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2088,22 +2088,6 @@ func TestAgent_DebugServer(t *testing.T) {
require.NotNil(t, v)
})

t.Run("Token", func(t *testing.T) {
t.Parallel()

ctx := testutil.Context(t, testutil.WaitLong)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, srv.URL+"/debug/token", nil)
require.NoError(t, err)

res, err := srv.Client().Do(req)
require.NoError(t, err)
require.Equal(t, http.StatusOK, res.StatusCode)
defer res.Body.Close()
resBody, err := io.ReadAll(res.Body)
require.NoError(t, err)
require.Equal(t, "token", string(resBody))
})

t.Run("Logs", func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletionagent/api.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,7 +40,6 @@ func (a *agent) apiHandler() http.Handler {
r.Get("/debug/magicsock", a.HandleHTTPDebugMagicsock)
r.Get("/debug/magicsock/debug-logging/{state}", a.HandleHTTPMagicsockDebugLoggingState)
r.Get("/debug/manifest", a.HandleHTTPDebugManifest)
r.Get("/debug/token", a.HandleHTTPDebugToken)

return r
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp