diff --git a/opensearchpy/_async/http_aiohttp.py b/opensearchpy/_async/http_aiohttp.py index c49fd574..b3f5c49d 100644 --- a/opensearchpy/_async/http_aiohttp.py +++ b/opensearchpy/_async/http_aiohttp.py @@ -246,12 +246,8 @@ async def perform_request( else: query_string = "" - # There is a bug in aiohttp that disables the re-use - # of the connection in the pool when method=HEAD. - # See: aio-libs/aiohttp#1769 is_head = False if method == "HEAD": - method = "GET" is_head = True # Top-tier tip-toeing happening here. Basically @@ -301,9 +297,9 @@ async def perform_request( timeout=timeout, fingerprint=self.ssl_assert_fingerprint, ) as response: - if is_head: # We actually called 'GET' so throw away the data. + if is_head: await response.release() - raw_data = "" + raw_data = "" # HEAD method has no response body else: raw_data = await response.text() duration = self.loop.time() - start diff --git a/opensearchpy/connection/http_async.py b/opensearchpy/connection/http_async.py index f5a4ec7c..49d91872 100644 --- a/opensearchpy/connection/http_async.py +++ b/opensearchpy/connection/http_async.py @@ -167,12 +167,8 @@ async def perform_request( else: query_string = "" - # There is a bug in aiohttp that disables the re-use - # of the connection in the pool when method=HEAD. - # See: https://github.com/aio-libs/aiohttp/issues/1769 is_head = False if method == "HEAD": - method = "GET" is_head = True # Top-tier tip-toeing happening here. Basically @@ -221,9 +217,9 @@ async def perform_request( timeout=timeout, fingerprint=self.ssl_assert_fingerprint, ) as response: - if is_head: # We actually called 'GET' so throw away the data. + if is_head: await response.release() - raw_data = "" + raw_data = "" # HEAD method has no response body else: raw_data = await response.text() duration = self.loop.time() - start