@@ -589,20 +589,6 @@ func TestExecuteForDefaultServers(t *testing.T) {
589
589
}
590
590
}
591
591
592
- func getHeaderMatchType (matchType string ) dataplane.MatchType {
593
- if len (matchType ) == 0 {
594
- return dataplane .MatchTypeExact
595
- }
596
- return dataplane .MatchType (matchType )
597
- }
598
-
599
- func getQueryParamMatchType (matchType string ) dataplane.MatchType {
600
- if len (matchType ) == 0 {
601
- return dataplane .MatchTypeExact
602
- }
603
- return dataplane .MatchType (matchType )
604
- }
605
-
606
592
func TestCreateServers (t * testing.T ) {
607
593
t .Parallel ()
608
594
const (
@@ -724,30 +710,30 @@ func TestCreateServers(t *testing.T) {
724
710
{
725
711
Name : "Version" ,
726
712
Value : "V1" ,
727
- Type : getHeaderMatchType ( "" ) ,
713
+ Type : dataplane . MatchTypeExact ,
728
714
},
729
715
{
730
716
Name : "test" ,
731
717
Value : "foo" ,
732
- Type : getHeaderMatchType ( "" ) ,
718
+ Type : dataplane . MatchTypeExact ,
733
719
},
734
720
{
735
721
Name : "my-header" ,
736
722
Value : "my-value" ,
737
- Type : getHeaderMatchType ( "" ) ,
723
+ Type : dataplane . MatchTypeExact ,
738
724
},
739
725
},
740
726
QueryParams : []dataplane.HTTPQueryParamMatch {
741
727
{
742
728
// query names and values should not be normalized to lowercase
743
729
Name : "GrEat" ,
744
730
Value : "EXAMPLE" ,
745
- Type : getQueryParamMatchType ( "" ) ,
731
+ Type : dataplane . MatchTypeExact ,
746
732
},
747
733
{
748
734
Name : "test" ,
749
735
Value : "foo=bar" ,
750
- Type : getQueryParamMatchType ( "" ) ,
736
+ Type : dataplane . MatchTypeExact ,
751
737
},
752
738
},
753
739
},
@@ -816,7 +802,7 @@ func TestCreateServers(t *testing.T) {
816
802
{
817
803
Name : "redirect" ,
818
804
Value : "this" ,
819
- Type : getHeaderMatchType ( "" ) ,
805
+ Type : dataplane . MatchTypeExact ,
820
806
},
821
807
},
822
808
},
@@ -859,7 +845,7 @@ func TestCreateServers(t *testing.T) {
859
845
{
860
846
Name : "rewrite" ,
861
847
Value : "this" ,
862
- Type : getHeaderMatchType ( "" ) ,
848
+ Type : dataplane . MatchTypeExact ,
863
849
},
864
850
},
865
851
},
@@ -899,7 +885,7 @@ func TestCreateServers(t *testing.T) {
899
885
{
900
886
Name : "filter" ,
901
887
Value : "this" ,
902
- Type : getHeaderMatchType ( "" ) ,
888
+ Type : dataplane . MatchTypeExact ,
903
889
},
904
890
},
905
891
},
@@ -2724,17 +2710,17 @@ func TestCreateRouteMatch(t *testing.T) {
2724
2710
{
2725
2711
Name : "header-1" ,
2726
2712
Value : "val-1" ,
2727
- Type : getHeaderMatchType ( "" ) ,
2713
+ Type : dataplane . MatchTypeExact ,
2728
2714
},
2729
2715
{
2730
2716
Name : "header-2" ,
2731
2717
Value : "val-2" ,
2732
- Type : getHeaderMatchType ( "" ) ,
2718
+ Type : dataplane . MatchTypeExact ,
2733
2719
},
2734
2720
{
2735
2721
Name : "header-3" ,
2736
2722
Value : "val-3" ,
2737
- Type : getHeaderMatchType ( "" ) ,
2723
+ Type : dataplane . MatchTypeExact ,
2738
2724
},
2739
2725
}
2740
2726
@@ -2750,17 +2736,17 @@ func TestCreateRouteMatch(t *testing.T) {
2750
2736
{
2751
2737
Name : "arg1" ,
2752
2738
Value : "val1" ,
2753
- Type : getQueryParamMatchType ( "" ) ,
2739
+ Type : dataplane . MatchTypeExact ,
2754
2740
},
2755
2741
{
2756
2742
Name : "arg2" ,
2757
2743
Value : "val2=another-val" ,
2758
- Type : getQueryParamMatchType ( "" ) ,
2744
+ Type : dataplane . MatchTypeExact ,
2759
2745
},
2760
2746
{
2761
2747
Name : "arg3" ,
2762
2748
Value : "==val3" ,
2763
- Type : getQueryParamMatchType ( "" ) ,
2749
+ Type : dataplane . MatchTypeExact ,
2764
2750
},
2765
2751
}
2766
2752
@@ -2895,7 +2881,7 @@ func TestCreateQueryParamKeyValString(t *testing.T) {
2895
2881
input : dataplane.HTTPQueryParamMatch {
2896
2882
Name : "key" ,
2897
2883
Value : "value" ,
2898
- Type : getQueryParamMatchType ( string ( dataplane .MatchTypeExact )) ,
2884
+ Type : dataplane .MatchTypeExact ,
2899
2885
},
2900
2886
expected : "key=Exact=value" ,
2901
2887
},
@@ -2904,7 +2890,7 @@ func TestCreateQueryParamKeyValString(t *testing.T) {
2904
2890
input : dataplane.HTTPQueryParamMatch {
2905
2891
Name : "KeY" ,
2906
2892
Value : "vaLUe-[a-z]==" ,
2907
- Type : getQueryParamMatchType ( string ( dataplane .MatchTypeRegularExpression )) ,
2893
+ Type : dataplane .MatchTypeRegularExpression ,
2908
2894
},
2909
2895
expected : "KeY=RegularExpression=vaLUe-[a-z]==" ,
2910
2896
},
@@ -2913,7 +2899,7 @@ func TestCreateQueryParamKeyValString(t *testing.T) {
2913
2899
input : dataplane.HTTPQueryParamMatch {
2914
2900
Name : "keY" ,
2915
2901
Value : "vaLUe==" ,
2916
- Type : getQueryParamMatchType ( "" ) ,
2902
+ Type : dataplane . MatchTypeExact ,
2917
2903
},
2918
2904
expected : "keY=Exact=vaLUe==" ,
2919
2905
},
@@ -2939,7 +2925,7 @@ func TestCreateHeaderKeyValString(t *testing.T) {
2939
2925
dataplane.HTTPHeaderMatch {
2940
2926
Name : "kEy" ,
2941
2927
Value : "vALUe" ,
2942
- Type : getHeaderMatchType ( string ( dataplane .MatchTypeExact )) ,
2928
+ Type : dataplane .MatchTypeExact ,
2943
2929
},
2944
2930
)
2945
2931
@@ -2951,7 +2937,7 @@ func TestCreateHeaderKeyValString(t *testing.T) {
2951
2937
dataplane.HTTPHeaderMatch {
2952
2938
Name : "kEy" ,
2953
2939
Value : "vALUe-[0-9]" ,
2954
- Type : getHeaderMatchType ( string ( dataplane .MatchTypeRegularExpression )) ,
2940
+ Type : dataplane .MatchTypeRegularExpression ,
2955
2941
},
2956
2942
)
2957
2943
0 commit comments