@@ -662,11 +662,10 @@ func (s *ServerTestSuite) Test_GetServiceFromUrl_SetsServicePathToSlash_WhenDoma
662662
663663func (s * ServerTestSuite ) Test_GetServicesFromEnvVars_ReturnsServices () {
664664 service := proxy.Service {
665- AclName : "my-AclName" ,
666- AddReqHeader : []string {"add-header-1" , "add-header-2" },
667- AddResHeader : []string {"add-header-1" , "add-header-2" },
668- CompressionAlgo : "compressionAlgo" ,
669- // CompressionType: "compressionType",
665+ AclName : "my-AclName" ,
666+ AddReqHeader : []string {"add-header-1" , "add-header-2" },
667+ AddResHeader : []string {"add-header-1" , "add-header-2" },
668+ CompressionAlgo : "compressionAlgo" ,
670669 ConnectionMode : "my-connection-mode" ,
671670 DelReqHeader : []string {"del-header-1" , "del-header-2" },
672671 DelResHeader : []string {"del-header-1" , "del-header-2" },
@@ -675,8 +674,6 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServices() {
675674 IsDefaultBackend : true ,
676675 PathType : "my-PathType" ,
677676 RedirectWhenHttpProto : true ,
678- ReqPathReplace : "my-ReqPathReplace" ,
679- ReqPathSearch : "my-ReqPathSearch" ,
680677 ServiceCert : "my-ServiceCert" ,
681678 ServiceDomainAlgo : "hdr_dom" ,
682679 ServiceName : "my-ServiceName" ,
@@ -689,14 +686,15 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServices() {
689686 TimeoutTunnel : "my-TimeoutTunnel" ,
690687 ServiceDest : []proxy.ServiceDest {
691688 {
692- HttpsOnly : true ,
693- HttpsRedirectCode : "302" ,
694- OutboundHostname : "my-OutboundHostname" ,
695- Port : "1111" ,
696- ServiceDomain : []string {"my-domain-1.com" , "my-domain-2.com" },
697- ServicePath : []string {"my-path-11" , "my-path-12" },
698- SrcPort : 1112 ,
699- ReqMode : "my-ReqMode" ,
689+ HttpsOnly : true ,
690+ HttpsRedirectCode : "302" ,
691+ OutboundHostname : "my-OutboundHostname" ,
692+ Port : "1111" ,
693+ ReqPathSearchReplace : "/something,/else" ,
694+ ServiceDomain : []string {"my-domain-1.com" , "my-domain-2.com" },
695+ ServicePath : []string {"my-path-11" , "my-path-12" },
696+ SrcPort : 1112 ,
697+ ReqMode : "my-ReqMode" ,
700698 },
701699 },
702700 }
@@ -717,8 +715,7 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServices() {
717715 os .Setenv ("DFP_SERVICE_PATH_TYPE" , service .PathType )
718716 os .Setenv ("DFP_SERVICE_REDIRECT_WHEN_HTTP_PROTO" , strconv .FormatBool (service .RedirectWhenHttpProto ))
719717 os .Setenv ("DFP_SERVICE_REQ_MODE" , service .ServiceDest [0 ].ReqMode )
720- os .Setenv ("DFP_SERVICE_REQ_PATH_REPLACE" , service .ReqPathReplace )
721- os .Setenv ("DFP_SERVICE_REQ_PATH_SEARCH" , service .ReqPathSearch )
718+ os .Setenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE" , service .ServiceDest [0 ].ReqPathSearchReplace )
722719 os .Setenv ("DFP_SERVICE_SERVICE_CERT" , service .ServiceCert )
723720 os .Setenv ("DFP_SERVICE_SERVICE_DOMAIN" , strings .Join (service .ServiceDest [0 ].ServiceDomain , "," ))
724721 os .Setenv ("DFP_SERVICE_SERVICE_DOMAIN_ALGO" , service .ServiceDomainAlgo )
@@ -753,8 +750,7 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServices() {
753750 os .Unsetenv ("DFP_SERVICE_PORT" )
754751 os .Unsetenv ("DFP_SERVICE_REDIRECT_WHEN_HTTP_PROTO" )
755752 os .Unsetenv ("DFP_SERVICE_REQ_MODE" )
756- os .Unsetenv ("DFP_SERVICE_REQ_PATH_REPLACE" )
757- os .Unsetenv ("DFP_SERVICE_REQ_PATH_SEARCH" )
753+ os .Unsetenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE" )
758754 os .Unsetenv ("DFP_SERVICE_SERVICE_CERT" )
759755 os .Unsetenv ("DFP_SERVICE_SERVICE_DOMAIN" )
760756 os .Unsetenv ("DFP_SERVICE_SERVICE_DOMAIN_ALGO" )
@@ -812,17 +808,31 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServicesWithIndexed
812808 expected := proxy.Service {
813809 ServiceName : "my-ServiceName" ,
814810 ServiceDest : []proxy.ServiceDest {
815- {Port : "1111" , ServicePath : []string {"my-path-11" , "my-path-12" }, SrcPort : 1112 , HttpsOnly : true },
816- {Port : "2221" , ServicePath : []string {"my-path-21" , "my-path-22" }, SrcPort : 2222 , HttpsOnly : false , OutboundHostname : "my-outbound-domain.com" },
811+ {
812+ Port : "1111" ,
813+ ReqPathSearchReplace : "/this,/that" ,
814+ ServicePath : []string {"my-path-11" , "my-path-12" },
815+ SrcPort : 1112 ,
816+ HttpsOnly : true ,
817+ }, {
818+ Port : "2221" ,
819+ ReqPathSearchReplace : "/something,/else" ,
820+ ServicePath : []string {"my-path-21" , "my-path-22" },
821+ SrcPort : 2222 ,
822+ HttpsOnly : false ,
823+ OutboundHostname : "my-outbound-domain.com" ,
824+ },
817825 },
818826 }
819827 os .Setenv ("DFP_SERVICE_SERVICE_NAME" , expected .ServiceName )
820828 os .Setenv ("DFP_SERVICE_HTTPS_ONLY_1" , "true" )
821829 os .Setenv ("DFP_SERVICE_PORT_1" , expected .ServiceDest [0 ].Port )
830+ os .Setenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE_1" , expected .ServiceDest [0 ].ReqPathSearchReplace )
822831 os .Setenv ("DFP_SERVICE_SERVICE_PATH_1" , strings .Join (expected .ServiceDest [0 ].ServicePath , "," ))
823832 os .Setenv ("DFP_SERVICE_SRC_PORT_1" , strconv .Itoa (expected .ServiceDest [0 ].SrcPort ))
824833 os .Setenv ("DFP_SERVICE_HTTPS_ONLY_2" , "false" )
825834 os .Setenv ("DFP_SERVICE_PORT_2" , expected .ServiceDest [1 ].Port )
835+ os .Setenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE_2" , expected .ServiceDest [1 ].ReqPathSearchReplace )
826836 os .Setenv ("DFP_SERVICE_SERVICE_PATH_2" , strings .Join (expected .ServiceDest [1 ].ServicePath , "," ))
827837 os .Setenv ("DFP_SERVICE_SRC_PORT_2" , strconv .Itoa (expected .ServiceDest [1 ].SrcPort ))
828838 os .Setenv ("DFP_SERVICE_OUTBOUND_HOSTNAME_2" , expected .ServiceDest [1 ].OutboundHostname )
@@ -831,10 +841,12 @@ func (s *ServerTestSuite) Test_GetServicesFromEnvVars_ReturnsServicesWithIndexed
831841 os .Unsetenv ("DFP_SERVICE_SERVICE_NAME" )
832842 os .Unsetenv ("DFP_SERVICE_HTTPS_ONLY_1" )
833843 os .Unsetenv ("DFP_SERVICE_PORT_1" )
844+ os .Unsetenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE_1" )
834845 os .Unsetenv ("DFP_SERVICE_SERVICE_PATH_1" )
835846 os .Unsetenv ("DFP_SERVICE_SRC_PORT_1" )
836847 os .Unsetenv ("DFP_SERVICE_HTTPS_ONLY_2" )
837848 os .Unsetenv ("DFP_SERVICE_PORT_2" )
849+ os .Unsetenv ("DFP_SERVICE_REQ_PATH_SEARCH_REPLACE_2" )
838850 os .Unsetenv ("DFP_SERVICE_SERVICE_PATH_2" )
839851 os .Unsetenv ("DFP_SERVICE_SRC_PORT_2" )
840852 os .Unsetenv ("DFP_SERVICE_OUTBOUND_HOSTNAME_2" )
0 commit comments