File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,9 +94,11 @@ def __init__(
9494
9595 content_type = self .headers .get ("Content-Type" , "" )
9696 xml = ["text/xml" , "application/xml" ]
97- no_xml = ["text/plain" , "text/calendar" ]
97+ no_xml = ["text/plain" , "text/calendar" , "application/octet-stream" ]
9898 expect_xml = any ((content_type .startswith (x ) for x in xml ))
99- expect_no_xml = any ((content_type .startswith (x ) for x in no_xml )) or response .status_code > 399
99+ expect_no_xml = any ((content_type .startswith (x ) for x in no_xml ))
100+ if content_type and not expect_xml and not expect_no_xml :
101+ error .weirdness (f"Unexpected content type: { content_type } " )
100102 try :
101103 content_length = int (self .headers ["Content-Length" ])
102104 except :
@@ -905,6 +907,8 @@ def auto_conn(
905907 error .weirdness ("traceback from client()" )
906908 except ImportError :
907909 pass
910+ finally :
911+ sys .path = sys .path [2 :]
908912
909913 if environment :
910914 raise NotImplementedError (
You can’t perform that action at this time.
0 commit comments