Skip to content

Commit 2b4d109

Browse files
committed
Try to fix issue with IP address look-up
1 parent 689ef69 commit 2b4d109

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

geoblock_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,22 @@ func TestMultipleIpAddressesReverse(t *testing.T) {
208208
}
209209

210210
func TestMultipleIpAddressesProxy(t *testing.T) {
211+
mockServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
212+
// Intercept the request and log it or check its properties
213+
t.Logf("Intercepted request: %s %s", req.Method, req.URL.String())
214+
t.Logf("Headers: %v", req.Header)
215+
216+
// Customize the response
217+
rw.WriteHeader(http.StatusOK)
218+
_, _ = rw.Write([]byte(`CA`))
219+
}))
220+
defer mockServer.Close() // Ensure the server is closed when the test finishes
221+
211222
cfg := createTesterConfig()
212223

213224
cfg.Countries = append(cfg.Countries, "CA")
214225
cfg.XForwardedForReverseProxy = true
226+
cfg.API = mockServer.URL + "/{ip}"
215227

216228
ctx := context.Background()
217229
next := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {})

0 commit comments

Comments
 (0)