Skip to content

Commit

Permalink
Pass headers as geventhttpclient Headers object to _make_request
Browse files Browse the repository at this point in the history
  • Loading branch information
soitinj committed Sep 5, 2024
1 parent 68716e0 commit 93eee7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions locust/contrib/fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from charset_normalizer import detect
from gevent.timeout import Timeout
from geventhttpclient._parser import HTTPParseError
from geventhttpclient.client import HTTPClientPool
from geventhttpclient.client import HTTPClientPool, HTTPClient
from geventhttpclient.header import Headers
from geventhttpclient.response import HTTPConnectionClosed, HTTPSocketPoolResponse
from geventhttpclient.useragent import CompatRequest, CompatResponse, ConnectionError, UserAgent
Expand Down Expand Up @@ -164,10 +164,12 @@ def _send_request_safe_mode(self, method: str, url: str, **kwargs):
if hasattr(e, "response"):
r = e.response
else:
req_headers = HTTPClient.DEFAULT_HEADERS.copy()
req_headers.update(kwargs.get("headers"))
req = self.client._make_request(
url,
method=method,
headers=kwargs.get("headers"),
headers=req_headers,
payload=kwargs.get("payload"),
params=kwargs.get("params"),
)
Expand Down

0 comments on commit 93eee7b

Please sign in to comment.