21 lines
560 B
Go
21 lines
560 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestAdminLeadsResponseIsNotCacheable(t *testing.T) {
|
|
// Invalid dates return before storage access; no database or patient data needed.
|
|
a := &API{}
|
|
w := httptest.NewRecorder()
|
|
a.adminLeads(w, httptest.NewRequest(http.MethodGet, "/api/v1/admin/leads?from=invalid", nil), nil)
|
|
if w.Code != http.StatusBadRequest {
|
|
t.Fatalf("status = %d, want 400", w.Code)
|
|
}
|
|
if got := w.Header().Get("Cache-Control"); got != "no-store" {
|
|
t.Fatalf("Cache-Control = %q, want no-store", got)
|
|
}
|
|
}
|