Skip to content

Commit e127630

Browse files
[Backport maintenance/4.0.x] feat: add HTTPMethod enum support to brain_http (#2879)
feat: add HTTPMethod enum support to brain_http (#2878) Closes #2877 (cherry picked from commit ff7205c) Co-authored-by: Joao Faria <[email protected]>
1 parent 9f17568 commit e127630

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ What's New in astroid 4.1.0?
88
Release date: TBA
99

1010

11+
* Add ``HTTPMethod`` enum support to brain module for Python 3.11+.
12+
13+
Closes #4135
14+
1115

1216
What's New in astroid 4.0.2?
1317
============================

astroid/brain/brain_http.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,21 @@
1414
def _http_transform() -> nodes.Module:
1515
code = textwrap.dedent(
1616
"""
17-
from enum import IntEnum
17+
from enum import IntEnum, StrEnum
1818
from collections import namedtuple
1919
_HTTPStatus = namedtuple('_HTTPStatus', 'value phrase description')
2020
21+
class HTTPMethod(StrEnum):
22+
GET = "GET"
23+
POST = "POST"
24+
PUT = "PUT"
25+
DELETE = "DELETE"
26+
HEAD = "HEAD"
27+
OPTIONS = "OPTIONS"
28+
PATCH = "PATCH"
29+
TRACE = "TRACE"
30+
CONNECT = "CONNECT"
31+
2132
class HTTPStatus(IntEnum):
2233
2334
@property

0 commit comments

Comments
 (0)