Files
yovision/Bell/server/internal/platform/http_test.go
T

17 lines
447 B
Go

package platform
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestSecurityHeaders(t *testing.T) {
h := securityHeaders(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusNoContent) }))
recorder := httptest.NewRecorder()
h.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))
if recorder.Header().Get("X-Frame-Options") != "DENY" {
t.Fatal("missing frame protection")
}
}