pub const fn reason_phrase(status: u16) -> &'static strExpand description
The canonical reason phrase for a status code: every code in
the IANA HTTP Status Code Registry, with the RFC 9110 names;
"" for an unassigned code and for the reserved 306 and
418.
When the phrase is empty the serializer still writes the space
after the code (HTTP/1.1 299 CRLF), as RFC 9112 section 4
requires.
ยงExamples
use http_net::reason_phrase;
assert_eq!(reason_phrase(404), "Not Found");
assert_eq!(reason_phrase(103), "Early Hints");
assert_eq!(reason_phrase(418), "");
assert_eq!(reason_phrase(299), "");