diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-03-14 14:12:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-14 14:12:01 (GMT) |
commit | da52be47690da0d9f78d0dce9ee5c3e4dbef49e1 (patch) | |
tree | 12cd6fb0d3121d8c06645d231fa279c1f157768f /Lib | |
parent | b81f40f0adae3b1d1e57f9a89940ba827b9ede70 (diff) | |
download | cpython-da52be47690da0d9f78d0dce9ee5c3e4dbef49e1.zip cpython-da52be47690da0d9f78d0dce9ee5c3e4dbef49e1.tar.gz cpython-da52be47690da0d9f78d0dce9ee5c3e4dbef49e1.tar.bz2 |
bpo-39509: Update HTTP status code to follow IANA (GH-18294)
Add status codes 103 EARLY_HINTS and 425 TOO_EARLY.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/http/__init__.py | 4 | ||||
-rw-r--r-- | Lib/test/test_httplib.py | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Lib/http/__init__.py b/Lib/http/__init__.py index 350afe7..c8498be 100644 --- a/Lib/http/__init__.py +++ b/Lib/http/__init__.py @@ -17,6 +17,8 @@ class HTTPStatus(IntEnum): * RFC 2774: An HTTP Extension Framework * RFC 7725: An HTTP Status Code to Report Legal Obstacles * RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2) + * RFC 8297: An HTTP Status Code for Indicating Hints + * RFC 8470: Using Early Data in HTTP """ def __new__(cls, value, phrase, description=''): obj = int.__new__(cls, value) @@ -31,6 +33,7 @@ class HTTPStatus(IntEnum): SWITCHING_PROTOCOLS = (101, 'Switching Protocols', 'Switching to new protocol; obey Upgrade header') PROCESSING = 102, 'Processing' + EARLY_HINTS = 103, 'Early Hints' # success OK = 200, 'OK', 'Request fulfilled, document follows' @@ -105,6 +108,7 @@ class HTTPStatus(IntEnum): UNPROCESSABLE_ENTITY = 422, 'Unprocessable Entity' LOCKED = 423, 'Locked' FAILED_DEPENDENCY = 424, 'Failed Dependency' + TOO_EARLY = 425, 'Too Early' UPGRADE_REQUIRED = 426, 'Upgrade Required' PRECONDITION_REQUIRED = (428, 'Precondition Required', 'The origin server requires the request to be conditional') diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index e1aa414..95eca7e 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -1440,6 +1440,8 @@ class OfflineTest(TestCase): 'INSUFFICIENT_STORAGE', 'NOT_EXTENDED', 'NETWORK_AUTHENTICATION_REQUIRED', + 'EARLY_HINTS', + 'TOO_EARLY' ] for const in expected: with self.subTest(constant=const): |