MCPcopy Index your code
hub / github.com/unrolled/secure / TestBothXSSProtectionForRequestOnly

Function TestBothXSSProtectionForRequestOnly

secure_test.go:881–895  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

879}
880
881func TestBothXSSProtectionForRequestOnly(t *testing.T) {
882 xssVal := "0"
883 s := New(Options{
884 BrowserXssFilter: true,
885 CustomBrowserXssValue: xssVal,
886 })
887
888 res := httptest.NewRecorder()
889 req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/foo", nil)
890
891 s.HandlerForRequestOnly(myHandler).ServeHTTP(res, req)
892
893 expect(t, res.Code, http.StatusOK)
894 expect(t, res.Header().Get("X-XSS-Protection"), "")
895}
896
897func TestCsp(t *testing.T) {
898 s := New(Options{

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
expectFunction · 0.85
HandlerForRequestOnlyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…