Renamed provider key to name.
This commit is contained in:
Родитель
0972e3cb53
Коммит
5557135918
|
@ -2,11 +2,11 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
|
||||
using Microsoft.IIS.Administration.Core;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
||||
{
|
||||
using Microsoft.IIS.Administration.Core;
|
||||
using System;
|
||||
|
||||
// Keep public for resolution of enums from 'dynamic' types in helper classes i.e. DynamicHelper
|
||||
public enum OutboundRuleMatchType {
|
||||
ServerVariable,
|
||||
|
|
|
@ -171,6 +171,18 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
obj.response_cache_directive = ResponseCacheDirectiveHelper.ToJsonModel(rule.ResponseCacheDirective);
|
||||
}
|
||||
|
||||
//
|
||||
// condition_match_constraints
|
||||
if (fields.Exists("condition_match_constraints")) {
|
||||
obj.condition_match_constraints = LogicalGroupingHelper.ToJsonModel(rule.Conditions.LogicalGrouping);
|
||||
}
|
||||
|
||||
//
|
||||
// track_all_captures
|
||||
if (fields.Exists("track_all_captures")) {
|
||||
obj.track_all_captures = rule.Conditions.TrackAllCaptures;
|
||||
}
|
||||
|
||||
//
|
||||
// action
|
||||
if (fields.Exists("action")) {
|
||||
|
@ -203,18 +215,6 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
});
|
||||
}
|
||||
|
||||
//
|
||||
// condition_match_constraints
|
||||
if (fields.Exists("condition_match_constraints")) {
|
||||
obj.condition_match_constraints = LogicalGroupingHelper.ToJsonModel(rule.Conditions.LogicalGrouping);
|
||||
}
|
||||
|
||||
//
|
||||
// track_all_captures
|
||||
if (fields.Exists("track_all_captures")) {
|
||||
obj.track_all_captures = rule.Conditions.TrackAllCaptures;
|
||||
}
|
||||
|
||||
//
|
||||
// conditions
|
||||
if (fields.Exists("conditions")) {
|
||||
|
|
|
@ -155,6 +155,18 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
obj.response_cache_directive = ResponseCacheDirectiveHelper.ToJsonModel(rule.ResponseCacheDirective);
|
||||
}
|
||||
|
||||
//
|
||||
// condition_match_constraints
|
||||
if (fields.Exists("condition_match_constraints")) {
|
||||
obj.condition_match_constraints = LogicalGroupingHelper.ToJsonModel(rule.Conditions.LogicalGrouping);
|
||||
}
|
||||
|
||||
//
|
||||
// track_all_captures
|
||||
if (fields.Exists("track_all_captures")) {
|
||||
obj.track_all_captures = rule.Conditions.TrackAllCaptures;
|
||||
}
|
||||
|
||||
//
|
||||
// action
|
||||
if (fields.Exists("action")) {
|
||||
|
@ -188,18 +200,6 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
});
|
||||
}
|
||||
|
||||
//
|
||||
// condition_match_constraints
|
||||
if (fields.Exists("condition_match_constraints")) {
|
||||
obj.condition_match_constraints = LogicalGroupingHelper.ToJsonModel(rule.Conditions.LogicalGrouping);
|
||||
}
|
||||
|
||||
//
|
||||
// track_all_captures
|
||||
if (fields.Exists("track_all_captures")) {
|
||||
obj.track_all_captures = rule.Conditions.TrackAllCaptures;
|
||||
}
|
||||
|
||||
//
|
||||
// conditions
|
||||
if (fields.Exists("conditions")) {
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
if (fields.Exists("settings")) {
|
||||
obj.settings = provider.Settings.Select(s => {
|
||||
return new {
|
||||
key = s.Key,
|
||||
name = s.Key,
|
||||
value = s.Value
|
||||
};
|
||||
});
|
||||
|
@ -295,11 +295,11 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
throw new ApiArgumentException("settings.item");
|
||||
}
|
||||
|
||||
string key = DynamicHelper.Value(setting.key);
|
||||
string settingName = DynamicHelper.Value(setting.name);
|
||||
string value = DynamicHelper.Value(setting.value);
|
||||
|
||||
if (string.IsNullOrEmpty(key)) {
|
||||
throw new ApiArgumentException("settings.item.key", "Required");
|
||||
if (string.IsNullOrEmpty(settingName)) {
|
||||
throw new ApiArgumentException("settings.item.name", "Required");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(value)) {
|
||||
|
@ -307,7 +307,7 @@ namespace Microsoft.IIS.Administration.WebServer.UrlRewrite
|
|||
}
|
||||
|
||||
var set = provider.Settings.CreateElement();
|
||||
set.Key = key;
|
||||
set.Key = settingName;
|
||||
set.Value = value;
|
||||
|
||||
provider.Settings.Add(set);
|
||||
|
|
|
@ -635,11 +635,11 @@ namespace Microsoft.IIS.Administration.Tests
|
|||
type = "testType",
|
||||
settings = new object[] {
|
||||
new {
|
||||
key = "abc",
|
||||
name = "abc",
|
||||
value = "def"
|
||||
},
|
||||
new {
|
||||
key = "zyx",
|
||||
name = "zyx",
|
||||
value = "wvu"
|
||||
}
|
||||
},
|
||||
|
@ -657,15 +657,15 @@ namespace Microsoft.IIS.Administration.Tests
|
|||
type = "testType22",
|
||||
settings = new object[] {
|
||||
new {
|
||||
key = "igloo",
|
||||
name = "igloo",
|
||||
value = "anonymous"
|
||||
},
|
||||
new {
|
||||
key = "tea",
|
||||
name = "tea",
|
||||
value = "coffee"
|
||||
},
|
||||
new {
|
||||
key = "record",
|
||||
name = "record",
|
||||
value = "paper"
|
||||
}
|
||||
}
|
||||
|
@ -827,7 +827,7 @@ namespace Microsoft.IIS.Administration.Tests
|
|||
JObject m = aSettings[i];
|
||||
JObject rm = bSettings[i];
|
||||
|
||||
Assert.Equal(m.Value<string>("key"), rm.Value<string>("key"));
|
||||
Assert.Equal(m.Value<string>("name"), rm.Value<string>("name"));
|
||||
Assert.Equal(m.Value<string>("value"), rm.Value<string>("value"));
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче