Skip to main content

Crate yttp

Crate yttp 

Source
Expand description

§yttp - “Better HTTP”

A JSON/YAML façade for HTTP requests and responses. Provides header shortcuts, smart auth, content-type-driven body encoding, and structured response formatting.

Structs§

Request
Parsed HTTP request, ready to send.
Response
Structured response.
Status
Structured status.
UrlParts
URL components.

Enums§

Error
Error type for yttp operations.

Functions§

append_query_to_url
Append query parameters from a q: value to a URL string.
build_query_string
Build a URL query string from an object of key-value pairs.
collapse_headers
Collapse expanded headers back to shortcut form (inverse of expand_headers).
encode_body
Encode response body for structured output: JSON → value, UTF-8 → string, binary → base64.
expand
Expand yttp shortcuts on a parsed Value.
expand_headers
Expand shortcut keys and values in a headers map.
format_response
Format a full response as a structured value (s!, h, b).
from_json
Deserialize a JSON string into a Value. Fails if the input is not valid JSON.
from_str
Deserialize a JSON/YAML string into a Value (auto-detect format).
from_yaml
Deserialize a YAML string into a Value. Does not attempt JSON parsing.
headers_to_raw
Build request headers as raw HTTP string.
parse
Convenience: deserialize + expand. Equivalent to expand(from_str(s)?).
parse_request
Parse a request from a JSON/YAML value, expanding header shortcuts.
parse_url
Parse URL into components.
resolve_method
status_inline
Format status as an inline object {v, c, t}.

Type Aliases§

Result