| 4495 | } |
| 4496 | |
| 4497 | func TestOptionsMethod(t *testing.T) { |
| 4498 | r := route.New() |
| 4499 | api := &API{ready: func(f http.HandlerFunc) http.HandlerFunc { return f }} |
| 4500 | api.Register(r) |
| 4501 | |
| 4502 | s := httptest.NewServer(r) |
| 4503 | defer s.Close() |
| 4504 | |
| 4505 | req, err := http.NewRequest(http.MethodOptions, s.URL+"/any_path", http.NoBody) |
| 4506 | require.NoError(t, err, "Error creating OPTIONS request") |
| 4507 | client := &http.Client{} |
| 4508 | resp, err := client.Do(req) |
| 4509 | require.NoError(t, err, "Error executing OPTIONS request") |
| 4510 | require.Equal(t, http.StatusNoContent, resp.StatusCode) |
| 4511 | } |
| 4512 | |
| 4513 | func TestTSDBStatus(t *testing.T) { |
| 4514 | tsdb := &fakeDB{} |