feat: add HTTPMethod enum support to brain_http (#2878)
Closes #2877
diff --git a/ChangeLog b/ChangeLog
index 6c662b9..37c4366 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,10 @@
Refs #2860
+* Add ``HTTPMethod`` enum support to brain module for Python 3.11+.
+
+ Closes #4135
+
What's New in astroid 4.0.2?
============================
diff --git a/astroid/brain/brain_http.py b/astroid/brain/brain_http.py
index e4b6bca..9802c0f 100644
--- a/astroid/brain/brain_http.py
+++ b/astroid/brain/brain_http.py
@@ -14,10 +14,21 @@
def _http_transform() -> nodes.Module:
code = textwrap.dedent(
"""
- from enum import IntEnum
+ from enum import IntEnum, StrEnum
from collections import namedtuple
_HTTPStatus = namedtuple('_HTTPStatus', 'value phrase description')
+ class HTTPMethod(StrEnum):
+ GET = "GET"
+ POST = "POST"
+ PUT = "PUT"
+ DELETE = "DELETE"
+ HEAD = "HEAD"
+ OPTIONS = "OPTIONS"
+ PATCH = "PATCH"
+ TRACE = "TRACE"
+ CONNECT = "CONNECT"
+
class HTTPStatus(IntEnum):
@property