(t *testing.T)
| 848 | } |
| 849 | |
| 850 | func TestCustomXSSProtectionForRequestOnly(t *testing.T) { |
| 851 | xssVal := "1; report=https://example.com" |
| 852 | s := New(Options{ |
| 853 | CustomBrowserXssValue: xssVal, |
| 854 | }) |
| 855 | |
| 856 | res := httptest.NewRecorder() |
| 857 | req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/foo", nil) |
| 858 | |
| 859 | s.HandlerForRequestOnly(myHandler).ServeHTTP(res, req) |
| 860 | |
| 861 | expect(t, res.Code, http.StatusOK) |
| 862 | expect(t, res.Header().Get("X-XSS-Protection"), "") |
| 863 | } |
| 864 | |
| 865 | func TestBothXSSProtection(t *testing.T) { |
| 866 | xssVal := "0" |
nothing calls this directly
no test coverage detected
searching dependent graphs…