Fix missing imports and restore CORS middleware for tests

After conflict resolution from rebase, some imports were accidentally
removed and the CORS middleware function was eliminated but still
referenced by tests. This commit:
- Adds fmt import to api/rest/keys.go (used for error messages)
- Adds gorilla/mux import to cmd/server/main.go (used for router type)
- Restores newCORSMiddleware function to api/rest/router.go for test compatibility
- Formats code with gofmt
This commit is contained in:
2025-10-30 23:47:27 -07:00
parent 81d11e01bb
commit 56bfcb59d3
5 changed files with 68 additions and 11 deletions
+10 -10
View File
@@ -23,13 +23,13 @@ func TestCORSMiddleware_AllowedOrigin(t *testing.T) {
}))
tests := []struct {
name string
origin string
expectOrigin string
expectMethods string
expectHeaders string
expectMaxAge string
expectCreds string
name string
origin string
expectOrigin string
expectMethods string
expectHeaders string
expectMaxAge string
expectCreds string
}{
{
name: "allowed origin - example.com",
@@ -323,9 +323,9 @@ func TestDefaultCORSConfig(t *testing.T) {
// TestCORSMiddleware_MaxAge tests custom max age values
func TestCORSMiddleware_MaxAge(t *testing.T) {
tests := []struct {
name string
maxAge int
expectMaxAge string
name string
maxAge int
expectMaxAge string
}{
{
name: "zero max age",