Skip to content

Commit

Permalink
Fixes warning in RateLimitingPlugin. Closes microsoft#474 (microsoft#475
Browse files Browse the repository at this point in the history
)
  • Loading branch information
waldekmastykarz authored Jan 8, 2024
1 parent 0f79be1 commit 5172ef8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dev-proxy-plugins/Behavior/RateLimitingPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,13 @@ public override void Register(IPluginEvents pluginEvents,
base.Register(pluginEvents, context, urlsToWatch, configSection);

configSection?.Bind(_configuration);
_configuration.CustomResponseFile = Path.GetFullPath(ProxyUtils.ReplacePathTokens(_configuration.CustomResponseFile), Path.GetDirectoryName(context.Configuration?.ConfigFile ?? string.Empty) ?? string.Empty);
_loader = new RateLimitingCustomResponseLoader(_logger!, _configuration);
// load the responses from the configured mocks file
_loader.InitResponsesWatcher();
if (_configuration.WhenLimitExceeded == RateLimitResponseWhenLimitExceeded.Custom)
{
_configuration.CustomResponseFile = Path.GetFullPath(ProxyUtils.ReplacePathTokens(_configuration.CustomResponseFile), Path.GetDirectoryName(context.Configuration?.ConfigFile ?? string.Empty) ?? string.Empty);
_loader = new RateLimitingCustomResponseLoader(_logger!, _configuration);
// load the responses from the configured mocks file
_loader.InitResponsesWatcher();
}

pluginEvents.BeforeRequest += OnRequest;
pluginEvents.BeforeResponse += OnResponse;
Expand Down

0 comments on commit 5172ef8

Please sign in to comment.