Crates.io | cdumay_http |
lib.rs | cdumay_http |
version | 0.1.1 |
created_at | 2025-06-19 13:49:37.196436+00 |
updated_at | 2025-06-19 13:49:37.196436+00 |
description | A Rust Library for HTTP data |
homepage | https://github.com/cdumay/cdumay_http |
repository | https://github.com/cdumay/cdumay_http |
max_upload_size | |
id | 1718375 |
size | 20,343 |
This crate provides structured mapping from HTTP status codes to custom application including error types using the cdumay_core
crate. It is especially useful when you want to handle HTTP error responses in a standardized and extensible way.
cdumay_core
ecosystem.u16
The define_kinds!
macro associates each HTTP status code with:
The define_errors!
macro maps those kinds into named error types (e.g., NotFound
, TooManyRequests
, etc.).
use std::collections::BTreeMap;
use serde_value::Value;
use cdumay_http::HTTPErrorConverter;
let mut context = BTreeMap::new();
context.insert("url".to_string(), Value::String("https://example.com".to_string()));
let error = HTTPErrorConverter::from_u16(404, context);
println!("{:?}", error);