Skip to content

Commit f23c015

Browse files
committed
Add QUERY to methods that expect a body
1 parent f3b839d commit f23c015

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

Doc/library/http.client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ HTTPConnection Objects
289289
but there is a request body, one of those
290290
header fields will be added automatically. If
291291
*body* is ``None``, the Content-Length header is set to ``0`` for
292-
methods that expect a body (``PUT``, ``POST``, and ``PATCH``). If
292+
methods that expect a body (``PUT``, ``POST``, ``PATCH``, and ``QUERY``). If
293293
*body* is a string or a bytes-like object that is not also a
294294
:term:`file <file object>`, the Content-Length header is
295295
set to its length. Any other type of *body* (files

Lib/http/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167

168168
# We always set the Content-Length header for these methods because some
169169
# servers will otherwise respond with a 411
170-
_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'}
170+
_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT', 'QUERY'}
171171

172172

173173
def _encode(data, name='data'):

Lib/test/test_httplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def append(self, item):
179179
# Here, we're testing that methods expecting a body get a
180180
# content-length set to zero if the body is empty (either None or '')
181181
bodies = (None, '')
182-
methods_with_body = ('PUT', 'POST', 'PATCH')
182+
methods_with_body = ('PUT', 'POST', 'PATCH', 'QUERY')
183183
for method, body in itertools.product(methods_with_body, bodies):
184184
conn = client.HTTPConnection('example.com')
185185
conn.sock = FakeSocket(None)

0 commit comments

Comments
 (0)