HTTP methods (Effect's HttpMethod).
Values#
| Attribute | Type | Description |
|---|---|---|
ALL | frozenset[HttpMethod] |
Types#
| Type | Definition | Description |
|---|---|---|
HttpMethod | type HttpMethod = Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'TRACE', 'QUERY'] | |
NoBody | type NoBody = Literal['GET', 'HEAD', 'OPTIONS', 'TRACE'] | The methods whose requests carry no body. |
WithBody | type WithBody = Literal['POST', 'PUT', 'DELETE', 'PATCH', 'QUERY'] |
Functions#
has_body#
has_body(method: HttpMethod) -> TypeIs[WithBody]
has_body(method: str) -> boolWhether requests with method send their body. A method outside
HttpMethod (a received PROPFIND) can carry one, but is not
narrowed.
| Parameter | Type | Description |
|---|---|---|
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]| Parameter | Type | Description |
|---|---|---|
value | object |
Returns TypeIs[HttpMethod]
def is_http_method(value: object) -> TypeIs[HttpMethod]:
return value in ALL