File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -208,10 +208,22 @@ func TestMultipleIpAddressesReverse(t *testing.T) {
208
208
}
209
209
210
210
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
+
211
222
cfg := createTesterConfig ()
212
223
213
224
cfg .Countries = append (cfg .Countries , "CA" )
214
225
cfg .XForwardedForReverseProxy = true
226
+ cfg .API = mockServer .URL + "/{ip}"
215
227
216
228
ctx := context .Background ()
217
229
next := http .HandlerFunc (func (rw http.ResponseWriter , req * http.Request ) {})
You can’t perform that action at this time.
0 commit comments