Skip to content

Commit

Permalink
Prevent AIOHttpConnection from encoding the url a second time.
Browse files Browse the repository at this point in the history
Signed-off-by: Nathalie Jonathan <[email protected]>
  • Loading branch information
nathaliellenaa committed Nov 27, 2024
1 parent 4876424 commit 2de6b44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion opensearchpy/connection/http_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import warnings
from typing import Any, Collection, Mapping, Optional, Union

import yarl

from .._async._extra_imports import aiohttp, aiohttp_exceptions # type: ignore
from .._async.compat import get_running_loop
from .._async.http_aiohttp import AIOHttpConnection
Expand Down Expand Up @@ -210,7 +212,7 @@ async def perform_request(
try:
async with self.session.request(
method,
url,
yarl.URL(url, encoded=True),
data=body,
auth=auth,
headers=req_headers,
Expand Down
5 changes: 3 additions & 2 deletions test_opensearchpy/test_async/test_http_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from unittest import mock

import pytest
import yarl
from multidict import CIMultiDict

from opensearchpy._async._extra_imports import aiohttp # type: ignore
Expand Down Expand Up @@ -91,7 +92,7 @@ async def test_basicauth_in_request_session(self, mock_request: Any) -> None:
await c.perform_request("post", "/test")
mock_request.assert_called_with(
"post",
"http://localhost:9200/test",
yarl.URL("http://localhost:9200/test", encoded=True),
data=None,
auth=c._http_auth,
headers={},
Expand Down Expand Up @@ -120,7 +121,7 @@ def auth_fn(*args: Any, **kwargs: Any) -> Any:

mock_request.assert_called_with(
"post",
"http://localhost:9200/test",
yarl.URL("http://localhost:9200/test", encoded=True),
data=None,
auth=None,
headers={
Expand Down

0 comments on commit 2de6b44

Please sign in to comment.