(t *testing.T)
| 574 | } |
| 575 | |
| 576 | func TestStsHeaderWithSSLForRequestOnly(t *testing.T) { |
| 577 | s := New(Options{ |
| 578 | SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"}, |
| 579 | STSSeconds: 315360000, |
| 580 | }) |
| 581 | |
| 582 | res := httptest.NewRecorder() |
| 583 | req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/foo", nil) |
| 584 | req.URL.Scheme = httpSchema |
| 585 | req.Header.Add("X-Forwarded-Proto", "https") |
| 586 | |
| 587 | s.HandlerForRequestOnly(myHandler).ServeHTTP(res, req) |
| 588 | |
| 589 | expect(t, res.Code, http.StatusOK) |
| 590 | expect(t, res.Header().Get("Strict-Transport-Security"), "") |
| 591 | } |
| 592 | |
| 593 | func TestStsHeaderInDevMode(t *testing.T) { |
| 594 | s := New(Options{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…