Expand description
§vld-http-common — Shared HTTP helpers for vld web integrations
This crate provides common utility functions used by vld-axum,
vld-actix, vld-rocket, vld-poem, and vld-warp.
Not intended for direct use by end users — import via the framework-specific crate instead.
Structs§
- Error
Body - Simple error body:
{ "error": "..." }. - Error
With Message - Error body with a message:
{ "error": "...", "message": "..." }. - Validation
Error Body - Validation error response body:
{ "error": "Validation failed", "issues": [...] }. - Validation
Issue - A single validation issue:
{ "path": "...", "message": "..." }. - Validation
Issue With Code - A validation issue with an error code:
{ "path": "...", "message": "...", "code": "..." }.
Functions§
- coerce_
value - Coerce a raw string value into a typed JSON value.
- cookies_
to_ json - Build a JSON object from a
Cookieheader value. - extract_
path_ param_ names - Extract parameter names from a route pattern like
/users/{id}/posts/{post_id}. - format_
generic_ error - Build a generic JSON error body with a custom error string.
- format_
issues - Format a
VldErrorinto a list ofValidationIssuestructs. - format_
issues_ with_ code - Format issues with an additional
"code"key fromIssueCode::key(). - format_
json_ parse_ error - Build a JSON error body for invalid JSON parse errors.
- format_
payload_ too_ large - Build a JSON error body for payloads that exceed the size limit.
- format_
utf8_ error - Build a JSON error body for invalid UTF-8 payloads.
- format_
vld_ error - Format a
VldErrorinto a JSON object with"error"and"issues"keys — ready to be sent as a 422 response body. - parse_
query_ string - Parse a URL query string into a
serde_json::Map. - query_
string_ to_ json - Parse a URL query string into a
serde_json::Value::Object. - url_
decode - Minimal percent-decode for URL query parameters.