diff options
Diffstat (limited to 'src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs b/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs index 83f23058..920632ab 100644 --- a/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs +++ b/src/SMAPI.Web/Framework/RewriteRules/ConditionalRewriteSubdomainRule.cs @@ -22,7 +22,7 @@ namespace StardewModdingAPI.Web.Framework.RewriteRules /// <param name="shouldRewrite">A predicate which indicates when the rule should be applied.</param> public ConditionalRewriteSubdomainRule(Func<HttpRequest, bool> shouldRewrite = null) { - this.ShouldRewrite = shouldRewrite; + this.ShouldRewrite = shouldRewrite ?? (req => true); } /// <summary>Applies the rule. Implementations of ApplyRule should set the value for <see cref="RewriteContext.Result" /> (defaults to RuleResult.ContinueRules).</summary> @@ -32,7 +32,7 @@ namespace StardewModdingAPI.Web.Framework.RewriteRules HttpRequest request = context.HttpContext.Request; // check condition - if (this.ShouldRewrite != null && !this.ShouldRewrite(request)) + if (!this.ShouldRewrite(request)) return; // get host parts |