Files
Charon/backend/internal/caddy/ssrf_test_helpers_test.go
GitHub Actions 3aaa059a15 fix: authentication issues for certificate endpoints and improve test coverage
- Updated UsersPage tests to check for specific URL formats instead of regex patterns.
- Increased timeout for Go coverage report generation to handle larger repositories.
- Cleaned up generated artifacts before running CodeQL analysis to reduce false positives.
- Removed outdated QA testing report for authentication fixes on the certificates page.
- Added final report confirming successful resolution of authentication issues with certificate endpoints.
- Deleted previous test output files to maintain a clean test results directory.
2026-01-03 03:08:43 +00:00

30 lines
580 B
Go

package caddy
import (
"net/url"
"strconv"
"testing"
)
func expectedPortFromURL(t *testing.T, raw string) int {
t.Helper()
u, err := url.Parse(raw)
if err != nil {
t.Fatalf("failed to parse url %q: %v", raw, err)
}
p := u.Port()
if p == "" {
t.Fatalf("expected explicit port in url %q", raw)
}
port, err := strconv.Atoi(p)
if err != nil {
t.Fatalf("failed to parse port %q from url %q: %v", p, raw, err)
}
return port
}
func newTestClient(t *testing.T, raw string) *Client {
t.Helper()
return NewClientWithExpectedPort(raw, expectedPortFromURL(t, raw))
}