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:
+10
-10
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user