Skip to content

Commit 5b74a57

Browse files
simple test for proxy function
1 parent 4b5b04c commit 5b74a57

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

shared_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package shuffle
22

33
import (
44
"testing"
5+
"net/http"
56
)
67

78
func TestIsLoop(t *testing.T) {
@@ -26,3 +27,17 @@ func TestIsLoop(t *testing.T) {
2627
}
2728
}
2829
}
30+
31+
// Simple Test for HandleInternalProxy(client)
32+
// set env SHUFFLE_INTERNAL_HTTP_PROXY to test the function.
33+
func TestHandleInternalProxy(t *testing.T) {
34+
client := &http.Client{}
35+
result := HandleInternalProxy(client)
36+
37+
if result.Transport.(*http.Transport).Proxy != nil {
38+
proxyURL, _ := result.Transport.(*http.Transport).Proxy(nil)
39+
t.Logf("Proxy URL set: %v", proxyURL)
40+
} else {
41+
t.Log("No proxy set")
42+
}
43+
}

0 commit comments

Comments
 (0)