]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Make the MockTransport example more robust/correct (#1621)
authorVytautas Liuolia <vytautas.liuolia@gmail.com>
Sun, 2 May 2021 18:04:12 +0000 (20:04 +0200)
committerGitHub <noreply@github.com>
Sun, 2 May 2021 18:04:12 +0000 (20:04 +0200)
docs/advanced.md

index 4438cb2d6f280af3001f50dc29401626f3b5988a..5f900cf68776e5f771c044e6cdff77d436bed872 100644 (file)
@@ -1100,7 +1100,7 @@ def handler(request):
 
 
 # Switch to a mock transport, if the TESTING environment variable is set.
-if os.environ['TESTING'].upper() == "TRUE":
+if os.environ.get('TESTING', '').upper() == "TRUE":
     transport = httpx.MockTransport(handler)
 else:
     transport = httpx.HTTPTransport()