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

Function TestCustomFrameValueWithDenyForRequestOnly

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

Source from the content-addressed store, hash-verified

762}
763
764func TestCustomFrameValueWithDenyForRequestOnly(t *testing.T) {
765 s := New(Options{
766 FrameDeny: true,
767 CustomFrameOptionsValue: "SAMEORIGIN",
768 })
769
770 res := httptest.NewRecorder()
771 req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/foo", nil)
772
773 s.HandlerForRequestOnly(myHandler).ServeHTTP(res, req)
774
775 expect(t, res.Code, http.StatusOK)
776 expect(t, res.Header().Get("X-Frame-Options"), "")
777}
778
779func TestContentNosniff(t *testing.T) {
780 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…