fix(agent): correct usage of task in StartAgentServer and updated test expectations

This commit is contained in:
yusing
2025-10-22 00:02:13 +08:00
parent 203faa8e7e
commit 9c3346dd9d
5 changed files with 9 additions and 8 deletions

View File

@@ -100,7 +100,7 @@ func TestUserPassLoginCallbackHandler(t *testing.T) {
}
auth.PostAuthCallbackHandler(w, req)
if tt.wantErr {
expect.Equal(t, w.Code, http.StatusUnauthorized)
expect.Equal(t, w.Code, http.StatusBadRequest)
} else {
setCookie := expect.Must(http.ParseSetCookie(w.Header().Get("Set-Cookie")))
expect.True(t, setCookie.Name == auth.TokenCookieName())

View File

@@ -56,7 +56,7 @@ func TestBypassCIDR(t *testing.T) {
func TestBypassPath(t *testing.T) {
mr, err := ModifyRequest.New(map[string]any{
"bypass": []string{"path /test/*", "path /api"},
"bypass": []string{"path glob(/test/*)", "path /api"},
"set_headers": map[string]string{
"Test-Header": "test-value",
},
@@ -106,7 +106,7 @@ func TestReverseProxyBypass(t *testing.T) {
rp := reverseproxy.NewReverseProxy("test", url, fakeRoundTripper{})
err = PatchReverseProxy(rp, map[string]OptionsRaw{
"response": {
"bypass": "path /test/* | path /api",
"bypass": "path glob(/test/*) | path /api",
"set_headers": map[string]string{
"Test-Header": "test-value",
},

View File

@@ -474,6 +474,9 @@ func (r *Route) HomepageItem() homepage.Item {
}
func (r *Route) DisplayName() string {
if r.Homepage == nil { // should only happen in tests, Validate() should initialize it
return r.Alias
}
return r.Homepage.Name
}