Skip to content

Commit

Permalink
feat: HttpSession docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tdadela committed Jun 24, 2024
1 parent f9bcd7c commit b04aec4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions locust/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def _send_request_safe_mode(self, method, url, **kwargs):
def get(
self, url: str | bytes, *, data: Any | None = None, json: Any | None = None, **kwargs: Unpack[RESTKwargs]
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a GET request"""
kwargs.setdefault("allow_redirects", True)
return self.request("GET", url, data=data, json=json, **kwargs)

Expand All @@ -256,6 +257,7 @@ def options(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a OPTIONS request"""
kwargs.setdefault("allow_redirects", True)
return self.request("OPTIONS", url, data=data, json=json, **kwargs)

Expand All @@ -267,6 +269,7 @@ def head(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a HEAD request"""
kwargs.setdefault("allow_redirects", False)
return self.request("HEAD", url, data=data, json=json, **kwargs)

Expand All @@ -277,6 +280,7 @@ def post(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a POST request"""
return self.request("POST", url, data=data, json=json, **kwargs)

def put(
Expand All @@ -287,6 +291,7 @@ def put(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a PUT request"""
return self.request("PUT", url, data=data, json=json, **kwargs)

def patch(
Expand All @@ -297,6 +302,7 @@ def patch(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a PATCH request"""
return self.request("PATCH", url, data=data, json=json, **kwargs)

def delete(
Expand All @@ -307,6 +313,7 @@ def delete(
json: Any | None = None,
**kwargs: Unpack[RESTKwargs],
) -> ResponseContextManager | Response | LocustResponse:
"""Sends a DELETE request"""
return self.request("DELETE", url, data=data, json=json, **kwargs)


Expand Down

0 comments on commit b04aec4

Please sign in to comment.