@@ -898,7 +898,7 @@ func TestParseAllowRule(t *testing.T) {
898
898
input : "domain=google.com" ,
899
899
expectedRule : Rule {
900
900
Raw : "domain=google.com" ,
901
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("google " )},
901
+ HostPattern : []labelPattern {labelPattern ("google " ), labelPattern ("com " )},
902
902
},
903
903
expectError : false ,
904
904
},
@@ -917,7 +917,7 @@ func TestParseAllowRule(t *testing.T) {
917
917
expectedRule : Rule {
918
918
Raw : "method=POST domain=api.example.com" ,
919
919
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("POST" ): {}},
920
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example" ), labelPattern ("api " )},
920
+ HostPattern : []labelPattern {labelPattern ("api " ), labelPattern ("example" ), labelPattern ("com " )},
921
921
},
922
922
expectError : false ,
923
923
},
@@ -927,7 +927,7 @@ func TestParseAllowRule(t *testing.T) {
927
927
expectedRule : Rule {
928
928
Raw : "method=DELETE domain=test.com path=/resources/456" ,
929
929
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("DELETE" ): {}},
930
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("test " )},
930
+ HostPattern : []labelPattern {labelPattern ("test " ), labelPattern ("com " )},
931
931
PathPattern : []segmentPattern {segmentPattern ("resources" ), segmentPattern ("456" )},
932
932
},
933
933
expectError : false ,
@@ -937,7 +937,7 @@ func TestParseAllowRule(t *testing.T) {
937
937
input : "domain=*.example.com" ,
938
938
expectedRule : Rule {
939
939
Raw : "domain=*.example.com" ,
940
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example" ), labelPattern ("* " )},
940
+ HostPattern : []labelPattern {labelPattern ("* " ), labelPattern ("example" ), labelPattern ("com " )},
941
941
},
942
942
expectError : false ,
943
943
},
@@ -1104,7 +1104,7 @@ func TestEngineMatches(t *testing.T) {
1104
1104
{
1105
1105
name : "no method pattern allows all methods" ,
1106
1106
rule : Rule {
1107
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example " )},
1107
+ HostPattern : []labelPattern {labelPattern ("example " ), labelPattern ("com " )},
1108
1108
},
1109
1109
method : "DELETE" ,
1110
1110
url : "https://example.com/api" ,
@@ -1115,7 +1115,7 @@ func TestEngineMatches(t *testing.T) {
1115
1115
{
1116
1116
name : "host matches exact" ,
1117
1117
rule : Rule {
1118
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example " )},
1118
+ HostPattern : []labelPattern {labelPattern ("example " ), labelPattern ("com " )},
1119
1119
},
1120
1120
method : "GET" ,
1121
1121
url : "https://example.com/api" ,
@@ -1124,7 +1124,7 @@ func TestEngineMatches(t *testing.T) {
1124
1124
{
1125
1125
name : "host does not match" ,
1126
1126
rule : Rule {
1127
- HostPattern : []labelPattern {labelPattern ("org " ), labelPattern ("example " )},
1127
+ HostPattern : []labelPattern {labelPattern ("example " ), labelPattern ("org " )},
1128
1128
},
1129
1129
method : "GET" ,
1130
1130
url : "https://example.com/api" ,
@@ -1133,7 +1133,7 @@ func TestEngineMatches(t *testing.T) {
1133
1133
{
1134
1134
name : "subdomain matches" ,
1135
1135
rule : Rule {
1136
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example " )},
1136
+ HostPattern : []labelPattern {labelPattern ("example " ), labelPattern ("com " )},
1137
1137
},
1138
1138
method : "GET" ,
1139
1139
url : "https://api.example.com/users" ,
@@ -1142,7 +1142,7 @@ func TestEngineMatches(t *testing.T) {
1142
1142
{
1143
1143
name : "host pattern too long" ,
1144
1144
rule : Rule {
1145
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example " ), labelPattern ("api " ), labelPattern ("v1 " )},
1145
+ HostPattern : []labelPattern {labelPattern ("v1 " ), labelPattern ("api " ), labelPattern ("example " ), labelPattern ("com " )},
1146
1146
},
1147
1147
method : "GET" ,
1148
1148
url : "https://api.example.com/users" ,
@@ -1151,7 +1151,7 @@ func TestEngineMatches(t *testing.T) {
1151
1151
{
1152
1152
name : "host wildcard matches" ,
1153
1153
rule : Rule {
1154
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("* " )},
1154
+ HostPattern : []labelPattern {labelPattern ("* " ), labelPattern ("com " )},
1155
1155
},
1156
1156
method : "GET" ,
1157
1157
url : "https://test.com/api" ,
@@ -1228,7 +1228,7 @@ func TestEngineMatches(t *testing.T) {
1228
1228
name : "all patterns match" ,
1229
1229
rule : Rule {
1230
1230
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("POST" ): {}},
1231
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("api " )},
1231
+ HostPattern : []labelPattern {labelPattern ("api " ), labelPattern ("com " )},
1232
1232
PathPattern : []segmentPattern {segmentPattern ("" ), segmentPattern ("users" )},
1233
1233
},
1234
1234
method : "POST" ,
@@ -1239,7 +1239,7 @@ func TestEngineMatches(t *testing.T) {
1239
1239
name : "method fails combined test" ,
1240
1240
rule : Rule {
1241
1241
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("POST" ): {}},
1242
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("api " )},
1242
+ HostPattern : []labelPattern {labelPattern ("api " ), labelPattern ("com " )},
1243
1243
PathPattern : []segmentPattern {segmentPattern ("" ), segmentPattern ("users" )},
1244
1244
},
1245
1245
method : "GET" ,
@@ -1250,7 +1250,7 @@ func TestEngineMatches(t *testing.T) {
1250
1250
name : "host fails combined test" ,
1251
1251
rule : Rule {
1252
1252
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("POST" ): {}},
1253
- HostPattern : []labelPattern {labelPattern ("org " ), labelPattern ("api " )},
1253
+ HostPattern : []labelPattern {labelPattern ("api " ), labelPattern ("org " )},
1254
1254
PathPattern : []segmentPattern {segmentPattern ("" ), segmentPattern ("users" )},
1255
1255
},
1256
1256
method : "POST" ,
@@ -1261,7 +1261,7 @@ func TestEngineMatches(t *testing.T) {
1261
1261
name : "path fails combined test" ,
1262
1262
rule : Rule {
1263
1263
MethodPatterns : map [methodPattern ]struct {}{methodPattern ("POST" ): {}},
1264
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("api " )},
1264
+ HostPattern : []labelPattern {labelPattern ("api " ), labelPattern ("com " )},
1265
1265
PathPattern : []segmentPattern {segmentPattern ("" ), segmentPattern ("posts" )},
1266
1266
},
1267
1267
method : "POST" ,
@@ -1291,7 +1291,7 @@ func TestEngineMatches(t *testing.T) {
1291
1291
{
1292
1292
name : "invalid URL" ,
1293
1293
rule : Rule {
1294
- HostPattern : []labelPattern {labelPattern ("com " ), labelPattern ("example " )},
1294
+ HostPattern : []labelPattern {labelPattern ("example " ), labelPattern ("com " )},
1295
1295
},
1296
1296
method : "GET" ,
1297
1297
url : "not-a-valid-url" ,
0 commit comments