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

Function TestStsHeaderWithPreloadForRequest

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

Source from the content-addressed store, hash-verified

655}
656
657func TestStsHeaderWithPreloadForRequest(t *testing.T) {
658 s := New(Options{
659 STSSeconds: 315360000,
660 STSPreload: true,
661 })
662
663 res := httptest.NewRecorder()
664 req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/foo", nil)
665 req.URL.Scheme = httpsSchema
666
667 s.HandlerForRequestOnly(myHandler).ServeHTTP(res, req)
668
669 expect(t, res.Code, http.StatusOK)
670 expect(t, res.Header().Get("Strict-Transport-Security"), "")
671}
672
673func TestStsHeaderWithSubdomainsWithPreload(t *testing.T) {
674 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…