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

Commit653ddcc

Browse files
authored
fix(agent): remove unused token debug handler (#12602)
1 parent8d7819f commit653ddcc

File tree

3 files changed

+0
-30
lines changed

3 files changed

+0
-30
lines changed

‎agent/agent.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,18 +1714,6 @@ func (a *agent) HandleHTTPDebugManifest(w http.ResponseWriter, r *http.Request)
17141714
}
17151715
}
17161716

1717-
func (a*agent)HandleHTTPDebugToken(w http.ResponseWriter,r*http.Request) {
1718-
tok:=a.sessionToken.Load()
1719-
iftok==nil {
1720-
a.logger.Error(r.Context(),"no session token in-memory")
1721-
w.WriteHeader(http.StatusInternalServerError)
1722-
_,_=fmt.Fprintf(w,"no session token in-memory")
1723-
return
1724-
}
1725-
w.WriteHeader(http.StatusOK)
1726-
_,_=fmt.Fprintf(w,*tok)
1727-
}
1728-
17291717
func (a*agent)HandleHTTPDebugLogs(w http.ResponseWriter,r*http.Request) {
17301718
logPath:=filepath.Join(a.logDir,"coder-agent.log")
17311719
f,err:=os.Open(logPath)
@@ -1753,7 +1741,6 @@ func (a *agent) HTTPDebug() http.Handler {
17531741
r.Get("/debug/magicsock",a.HandleHTTPDebugMagicsock)
17541742
r.Get("/debug/magicsock/debug-logging/{state}",a.HandleHTTPMagicsockDebugLoggingState)
17551743
r.Get("/debug/manifest",a.HandleHTTPDebugManifest)
1756-
r.Get("/debug/token",a.HandleHTTPDebugToken)
17571744
r.NotFound(func(w http.ResponseWriter,r*http.Request) {
17581745
w.WriteHeader(http.StatusNotFound)
17591746
_,_=w.Write([]byte("404 not found"))

‎agent/agent_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,22 +2088,6 @@ func TestAgent_DebugServer(t *testing.T) {
20882088
require.NotNil(t,v)
20892089
})
20902090

2091-
t.Run("Token",func(t*testing.T) {
2092-
t.Parallel()
2093-
2094-
ctx:=testutil.Context(t,testutil.WaitLong)
2095-
req,err:=http.NewRequestWithContext(ctx,http.MethodGet,srv.URL+"/debug/token",nil)
2096-
require.NoError(t,err)
2097-
2098-
res,err:=srv.Client().Do(req)
2099-
require.NoError(t,err)
2100-
require.Equal(t,http.StatusOK,res.StatusCode)
2101-
deferres.Body.Close()
2102-
resBody,err:=io.ReadAll(res.Body)
2103-
require.NoError(t,err)
2104-
require.Equal(t,"token",string(resBody))
2105-
})
2106-
21072091
t.Run("Logs",func(t*testing.T) {
21082092
t.Parallel()
21092093

‎agent/api.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func (a *agent) apiHandler() http.Handler {
4040
r.Get("/debug/magicsock",a.HandleHTTPDebugMagicsock)
4141
r.Get("/debug/magicsock/debug-logging/{state}",a.HandleHTTPMagicsockDebugLoggingState)
4242
r.Get("/debug/manifest",a.HandleHTTPDebugManifest)
43-
r.Get("/debug/token",a.HandleHTTPDebugToken)
4443

4544
returnr
4645
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp