Expand description
Framework-independent standard WIP over HTTP v1 binding.
This crate owns endpoint and route derivation, UTF-8 JSON encoding, canonical success and error response handling, HTTP status mapping, descriptor-guided operation-value conversion. It deliberately performs no I/O and depends on no server framework, TLS implementation, filesystem projection, client cache, or presentation layer. URL schemes, TLS, certificates, authentication mechanisms, proxies, and caches are selected by the HTTP implementation and deployment rather than by WIP conformance.
Logical values remain owned by wip_protocol. Validators and Bytes are
encoded in JSON bodies using canonical RFC 4648 Section 4 base64; this crate
does not infer WIP validator semantics from ETag or If-Match.
Interface references use exact JSON objects with required scope and name
strings in every position. Legacy strings and display shorthand are rejected.
Scope is a canonical absolute Worldspace path, not an HTTP endpoint prefix.
Optional scope_ref metadata on fetch responses and call interface targets is
an opaque string, never base64; absent fields are omitted and null is rejected.
Call metadata validates reference shape without resolving scope ancestry or
identity, which remain Host checks with InterfaceMismatch precedence.
use wip_http::{Endpoint, Limits, encode_observe_request};
use wip_protocol::ObserveRequest;
let endpoint = Endpoint::parse("http://example.test/api/wip")?;
let limits = Limits::new(64 * 1024, 1024 * 1024, 64)?;
let request = encode_observe_request(
&endpoint,
&ObserveRequest { path: "/items/123".into(), depth: 0 },
limits,
)?;
assert_eq!(request.uri(), "http://example.test/api/wip/v1/observe");
assert_eq!(request.method(), http::Method::POST);Re-exports§
pub use http;pub use url;pub use wip_protocol;
Structs§
- Call
Operation Metadata - Descriptor-independent fields needed to resolve a
call_operationrequest. - Endpoint
- A canonical absolute hierarchical base URL whose path always ends in
/. - Limits
- Caller-selected hard limits applied before or while decoding JSON.
- Status
Mismatch - Diagnostic evidence that HTTP metadata disagrees with a valid error envelope.
- Transport
Binding Failure - A non-success HTTP response that is not a valid WIP protocol failure.
Enums§
- Body
Kind - Whether a body is being decoded as a request or response.
- Client
Response Error - A local failure while classifying or validating a peer response.
- Codec
Error - A malformed or locally disallowed wire representation.
- Decoded
Response - A successfully classified client response.
- Encode
Http Error - Failure while building an outbound framework-neutral HTTP message.
- Endpoint
Error - Why an endpoint is not a valid standard WIP over HTTP base.
- Invalid
Response Kind - Why a response violates the WIP v1 response contract.
- Limit
Configuration Error - Why a
Limitsconfiguration is not bounded. - Request
Metadata Error - A failure while validating inbound HTTP request metadata.
- Route
- A fixed standard WIP over HTTP v1 route.
- Transport
Failure Kind - Class of non-protocol HTTP failure returned without a valid WIP envelope.
Constants§
- JSON_
CONTENT_ TYPE - The media type emitted for every WIP request and every response with a body.
Functions§
- decode_
call_ operation_ metadata - Decodes descriptor-independent
call_operationrouting metadata. - decode_
call_ operation_ request - Decodes a descriptor-bound
call_operationrequest body. - decode_
call_ operation_ response - Decodes and classifies a descriptor-bound
call_operationclient response. - decode_
fetch_ interface_ request - Decodes a
fetch_interfacerequest body. - decode_
fetch_ interface_ response - Decodes and classifies a
fetch_interfaceclient response. - decode_
observe_ request - Decodes an
observerequest body. - decode_
observe_ response - Decodes and classifies an
observeclient response. - encode_
call_ operation_ request - Encodes a descriptor-bound
call_operationHTTP request. - encode_
call_ operation_ response - Encodes a successful
call_operationresponse as a direct body with HTTP 200. - encode_
fetch_ interface_ request - Encodes a
fetch_interfaceHTTP request. - encode_
fetch_ interface_ response - Encodes a successful
fetch_interfaceresponse as a direct body with HTTP 200. - encode_
observe_ request - Encodes an
observeHTTP request. - encode_
observe_ response - Encodes a successful
observeresponse as a direct body with HTTP 200. - encode_
protocol_ error_ response - Encodes a canonical Host error envelope using its standard HTTP status.
- error_
code_ name - Returns the stable snake-case wire spelling of a protocol code.
- is_
json_ content_ type - Returns whether a Content-Type value denotes UTF-8
application/json. - status_
for_ error - Returns the canonical HTTP status for a wire-level protocol error.
- validate_
http_ request - Validates mandatory HTTP metadata for an inbound WIP request.