@@ -24,7 +24,6 @@ import (
24
24
"net"
25
25
"net/http"
26
26
"path"
27
- "strings"
28
27
"sync"
29
28
"time"
30
29
@@ -970,10 +969,15 @@ var _ = Describe("manger.Manager", func() {
970
969
Expect (err ).NotTo (HaveOccurred ())
971
970
Expect (resp .StatusCode ).To (Equal (http .StatusOK ))
972
971
973
- // Check readiness path without trailing slash
974
- readinessEndpoint = fmt .Sprint ("http://" , listener .Addr ().String (), strings . TrimSuffix ( defaultReadinessEndpoint , "/" ) )
972
+ // Check readiness path without trailing slash without redirect
973
+ readinessEndpoint = fmt .Sprint ("http://" , listener .Addr ().String (), defaultReadinessEndpoint )
975
974
res = nil
976
- resp , err = http .Get (readinessEndpoint )
975
+ httpClient := http.Client {
976
+ CheckRedirect : func (req * http.Request , via []* http.Request ) error {
977
+ return http .ErrUseLastResponse // Do not follow redirect
978
+ },
979
+ }
980
+ resp , err = httpClient .Get (readinessEndpoint )
977
981
Expect (err ).NotTo (HaveOccurred ())
978
982
Expect (resp .StatusCode ).To (Equal (http .StatusOK ))
979
983
@@ -1016,10 +1020,15 @@ var _ = Describe("manger.Manager", func() {
1016
1020
Expect (err ).NotTo (HaveOccurred ())
1017
1021
Expect (resp .StatusCode ).To (Equal (http .StatusOK ))
1018
1022
1019
- // Check liveness path without trailing slash
1020
- livenessEndpoint = fmt .Sprint ("http://" , listener .Addr ().String (), strings . TrimSuffix ( defaultLivenessEndpoint , "/" ) )
1023
+ // Check liveness path without trailing slash without redirect
1024
+ livenessEndpoint = fmt .Sprint ("http://" , listener .Addr ().String (), defaultLivenessEndpoint )
1021
1025
res = nil
1022
- resp , err = http .Get (livenessEndpoint )
1026
+ httpClient := http.Client {
1027
+ CheckRedirect : func (req * http.Request , via []* http.Request ) error {
1028
+ return http .ErrUseLastResponse // Do not follow redirect
1029
+ },
1030
+ }
1031
+ resp , err = httpClient .Get (livenessEndpoint )
1023
1032
Expect (err ).NotTo (HaveOccurred ())
1024
1033
Expect (resp .StatusCode ).To (Equal (http .StatusOK ))
1025
1034
0 commit comments