From 70eb33272ec438d16d40f9c5221126111999c2f0 Mon Sep 17 00:00:00 2001 From: ArkadyRudenko Date: Fri, 9 Aug 2024 13:26:50 +0600 Subject: [PATCH] Fix HTTP/2 docs --- docs/http2.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/http2.md b/docs/http2.md index 434606c411..a49c8ece4e 100644 --- a/docs/http2.md +++ b/docs/http2.md @@ -58,6 +58,13 @@ requests and responses will be transported over HTTP/2, since both the client *and* the server need to support HTTP/2. If you connect to a server that only supports HTTP/1.1 the client will use a standard HTTP/1.1 connection instead. +To force HTTP/2 to be enabled, disable HTTP/1.1. Otherwise, the client will try to use HTTP/1.1 +```python +client = httpx.AsyncClient(http1=False, http2=True) +# or +async with httpx.AsyncClient(http1=False, http2=True) as client: +``` + You can determine which version of the HTTP protocol was used by examining the `.http_version` property on the response.