GitHub

API reference for method.

HTTP methods (Effect's HttpMethod).

Values

AttributeTypeDescription
ALLfrozenset[HttpMethod]

Types

TypeDefinitionDescription
HttpMethodtype HttpMethod = Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'TRACE', 'QUERY']
NoBodytype NoBody = Literal['GET', 'HEAD', 'OPTIONS', 'TRACE']

The methods whose requests carry no body.

WithBodytype WithBody = Literal['POST', 'PUT', 'DELETE', 'PATCH', 'QUERY']

Functions

has_body

has_body(method: HttpMethod) -> TypeIs[WithBody]
has_body(method: str) -> bool

Whether requests with method send their body. A method outside HttpMethod (a received PROPFIND) can carry one, but is not narrowed.

ParameterTypeDescription
method
@overload
def has_body(method: HttpMethod) -> TypeIs[WithBody]: ...
@overload
def has_body(method: str) -> bool: ...
def has_body(method: str) -> bool:
    """Whether requests with ``method`` send their body. A method outside
    ``HttpMethod`` (a received ``PROPFIND``) can carry one, but is not
    narrowed."""
    return method not in ("GET", "HEAD", "OPTIONS", "TRACE")

is_http_method

is_http_method(value) -> TypeIs[HttpMethod]
ParameterTypeDescription
valueobject

Returns TypeIs[HttpMethod]

def is_http_method(value: object) -> TypeIs[HttpMethod]:
    return value in ALL