(t *testing.T)
| 120 | } |
| 121 | |
| 122 | func TestRequireAPIKey(t *testing.T) { |
| 123 | setupTest(t) |
| 124 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 125 | req.Header.Set("Content-Type", "application/json") |
| 126 | response := httptest.NewRecorder() |
| 127 | // Test that making a request without an API key is denied |
| 128 | RequireAPIKey(successHandler).ServeHTTP(response, req) |
| 129 | expected := http.StatusUnauthorized |
| 130 | got := response.Code |
| 131 | if got != expected { |
| 132 | t.Fatalf("incorrect status code received. expected %d got %d", expected, got) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestCORSHeaders(t *testing.T) { |
| 137 | setupTest(t) |
nothing calls this directly
no test coverage detected