Skip to main content

Crate vld_http_common

Crate vld_http_common 

Source
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§

ErrorBody
Simple error body: { "error": "..." }.
ErrorWithMessage
Error body with a message: { "error": "...", "message": "..." }.
ValidationErrorBody
Validation error response body: { "error": "Validation failed", "issues": [...] }.
ValidationIssue
A single validation issue: { "path": "...", "message": "..." }.
ValidationIssueWithCode
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 Cookie header 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 VldError into a list of ValidationIssue structs.
format_issues_with_code
Format issues with an additional "code" key from IssueCode::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 VldError into 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.