File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ def ziti_socket(type):
229
229
230
230
231
231
def ziti_close (fd ):
232
- _ziti_close (fd )
232
+ if fd :
233
+ _ziti_close (fd )
233
234
234
235
235
236
def shutdown ():
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def test_monkeypatch(self):
39
39
with self .assertRaises (ConnectionError ):
40
40
get_httpbin ('http://httpbin.ziti/json' )
41
41
42
- def test_resolve (selfs ):
42
+ def test_resolve (self ):
43
43
with openziti .monkeypatch ():
44
44
import socket
45
45
addrlist = socket .getaddrinfo (host = 'httpbin.ziti' , port = 80 , type = socket .SOCK_STREAM )
@@ -54,3 +54,12 @@ def test_resolve(selfs):
54
54
assert addr [1 ] == 80
55
55
assert addr [0 ].startswith ('100.64.0.' )
56
56
57
+ def test_monkeypatch_bypass (self ):
58
+ with openziti .monkeypatch ():
59
+ from json import dumps
60
+ r = get_httpbin ('http://httpbin.org/anything' )
61
+ assert r .status_code == 200
62
+ body = r .json ()
63
+ print (dumps (body , indent = 2 ))
64
+ self .assertRegex (body ['headers' ]['User-Agent' ], r'python-requests/.*' )
65
+
You can’t perform that action at this time.
0 commit comments