Skip to content

Commit

Permalink
Add shortcut for TRACE and QUERY(https://httpwg.org/http-extensions/d…
Browse files Browse the repository at this point in the history
  • Loading branch information
lexiforest committed Oct 10, 2024
1 parent 93e551d commit e93c239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions curl_cffi/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,5 @@ def request(
patch = partial(request, "PATCH")
delete = partial(request, "DELETE")
options = partial(request, "OPTIONS")
trace = partial(request, "TRACE")
query = partial(request, "QUERY")
6 changes: 5 additions & 1 deletion curl_cffi/requests/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class BaseSessionParams(TypedDict, total=False):
BaseSessionParams = TypedDict

ThreadType = Literal["eventlet", "gevent"]
HttpMethod = Literal["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "TRACE", "PATCH"]
HttpMethod = Literal["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD", "TRACE", "PATCH", "QUERY"]


def _is_absolute_url(url: str) -> bool:
Expand Down Expand Up @@ -1080,6 +1080,8 @@ def cleanup(fut):
patch = partialmethod(request, "PATCH")
delete = partialmethod(request, "DELETE")
options = partialmethod(request, "OPTIONS")
trace = partialmethod(request, "TRACE")
query = partialmethod(request, "QUERY")


class AsyncSession(BaseSession):
Expand Down Expand Up @@ -1364,3 +1366,5 @@ def cleanup(fut):
patch = partialmethod(request, "PATCH")
delete = partialmethod(request, "DELETE")
options = partialmethod(request, "OPTIONS")
trace = partialmethod(request, "TRACE")
query = partialmethod(request, "QUERY")

0 comments on commit e93c239

Please sign in to comment.