Skip to content

Commit ff7205c

Browse files
feat: add HTTPMethod enum support to brain_http (#2878)
Closes #2877
1 parent aca2802 commit ff7205c

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
@@ -23,6 +23,10 @@ Release date: TBA
2323

2424
Refs #2860
2525

26+
* Add ``HTTPMethod`` enum support to brain module for Python 3.11+.
27+
28+
Closes #4135
29+
2630

2731
What's New in astroid 4.0.2?
2832
============================

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)