Skip to content
Myr

Add "Early Hints" and "Too Early" to Status Codes (#1244)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

To align with Python 3.9: https://docs.python.org/3.9/whatsnew/3.9.html#http > HTTP status codes 103 EARLY_HINTS, 418 IM_A_TEAPOT and 425 TOO_EARLY are added to http.HTTPStatus. (Contributed by Dong-hee Na in bpo-39509 and Ross Rhodes in bpo-39507.) https://github.com/python/cpython/blob/da52be47690da0d9f78d0dce9ee5c3e4dbef49e1/Lib/http/__init__.py

authored by Stephen Brown II · committed by GitHub · parent e39a6d9 · Browse files · 1 file+6 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/python/cpython/blob/da52be47690da0d9f78d0dce9ee5c3e4dbef49e1/Lib/http/__init__.py

Diff stats

1 file+6 added−0 removed

  • other:+6 added−0 removed

1 file+6 added−0 removed

modified:httpx/_status_codes.py+6 added
2 unmodified lines
345class codes(IntEnum):6 """HTTP status codes and reason phrases78 Status codes from the following RFCs are all observed:910 * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 261611 * RFC 6585: Additional HTTP Status Codes12 * RFC 3229: Delta encoding in HTTP13 * RFC 4918: HTTP Extensions for WebDAV, obsoletes 2518
3 unmodified lines
17 * RFC 2774: An HTTP Extension Framework18 * RFC 7540: Hypertext Transfer Protocol Version 2 (HTTP/2)19 * RFC 2324: Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)20 * RFC 7725: An HTTP Status Code to Report Legal Obstacles21 * RFC 8297: An HTTP Status Code for Indicating Hints22 * RFC 8470: Using Early Data in HTTP23 """2425 def __new__(cls, value: int, phrase: str = "") -> "codes":26 obj = int.__new__(cls, value) # type: ignore
42 unmodified lines
69 # informational70 CONTINUE = 100, "Continue"71 SWITCHING_PROTOCOLS = 101, "Switching Protocols"72 PROCESSING = 102, "Processing"73 EARLY_HINTS = 103, "Early Hints"7475 # success76 OK = 200, "OK"77 CREATED = 201, "Created"
39 unmodified lines
117 MISDIRECTED_REQUEST = 421, "Misdirected Request"118 UNPROCESSABLE_ENTITY = 422, "Unprocessable Entity"119 LOCKED = 423, "Locked"120 FAILED_DEPENDENCY = 424, "Failed Dependency"121 TOO_EARLY = 425, "Too Early"122 UPGRADE_REQUIRED = 426, "Upgrade Required"123 PRECONDITION_REQUIRED = 428, "Precondition Required"124 TOO_MANY_REQUESTS = 429, "Too Many Requests"125 REQUEST_HEADER_FIELDS_TOO_LARGE = 431, "Request Header Fields Too Large"
39 unmodified lines