http-status-codes2

Crates.iohttp-status-codes2
lib.rshttp-status-codes2
version0.1.3
sourcesrc
created_at2024-02-17 04:34:46.789996
updated_at2024-02-17 08:18:41.951777
descriptionLibrary for HTTP status codes
homepage
repositoryhttps://github.com/fleetingbytes/http-status-codes2/
max_upload_size
id1143007
size21,665
(fleetingbytes)

documentation

https://docs.rs/http-status-codes2/

README

http-status-codes2

Provides a representation of IANA’s HTTP Status Code Registry and search functions to query it.

Also has an unofficial status code registry whech includes a few proposed or popular unofficial status codes.

A CLI is provided by the heman crate.

Usage exaple for the official registry:

use http_status_codes2::{find_by_code, status_code_registry::CODE_REGISTRY};

assert_eq!(
    find_by_code(100, &CODE_REGISTRY),
    Some((
        100,
        "Continue",
        "[RFC9110, Section 15.2.1]",
        "https://www.rfc-editor.org/rfc/rfc9110.html#section-15.2.1"
    ))
);
assert_eq!(find_by_code(600, &CODE_REGISTRY), None);

Usage exaple for the unofficial registry:

use http_status_codes2::{find_by_substring, status_code_registry::UNOFFICIAL_CODE_REGISTRY};

let mut it = find_by_substring("teapot", &UNOFFICIAL_CODE_REGISTRY);
assert_eq!(
    it.next(),
    Some((
        418,
        "I'm a teapot",
        "[RFC2324, Section 2.3.2]",
        "https://www.rfc-editor.org/rfc/rfc2324.html#section-2.3.2"
    ))
    .as_ref()
);
assert_eq!(it.next(), None);
Commit count: 0

cargo fmt