Expand description
HTTP status code to reason phrase mapping.
This module provides a single function, status_text, that maps numeric HTTP
status codes to their standard reason phrases (e.g., 200 -> “OK”, 404 -> “Not Found”).
It is used by Response::new to populate the reason field
when the upstream HTTP client does not provide one.
The lookup table covers all standard status codes defined in RFCs 7231, 7538, 6585, 4918, and others, including informational oddities like 418 “I’m a teapot”.
Functions§
- status_
text - Returns the standard reason phrase for an HTTP status code, or
"Unknown Status Code"if the code is not in the lookup table. The table is initialized once on first call and reused for the lifetime of the process.