Exemplo n.º 1
0
        public void SetReferrerPolicyHeader_NoOverride_DoesNothing()
        {
            var contextConfig = new ReferrerPolicyConfiguration();

            _contextHelper.Setup(h => h.GetReferrerPolicyConfiguration(It.IsAny <HttpContext>())).Returns(contextConfig);
            _configurationOverrideHelper.Setup(h => h.GetReferrerPolicyWithOverride(It.IsAny <HttpContext>())).Returns((ReferrerPolicyConfiguration)null);

            _overrideHelper.SetReferrerPolicyHeader(_mockContext);

            _headerGenerator.Verify(g => g.CreateReferrerPolicyResult(It.IsAny <ReferrerPolicyConfiguration>(), It.IsAny <ReferrerPolicyConfiguration>()), Times.Never);
            _headerResultHandler.Verify(h => h.HandleHeaderResult(It.IsAny <HttpResponse>(), It.IsAny <HeaderResult>()), Times.Never);
        }
Exemplo n.º 2
0
 public override void SetHttpHeadersOnActionExecuted(ActionExecutedContext filterContext)
 {
     _headerOverrideHelper.SetReferrerPolicyHeader(new HttpContextWrapper(filterContext.HttpContext));
 }