Expand description
Protocol constants for Braid-HTTP.
This module defines standard header names, status codes, merge type identifiers, and other protocol constants used throughout the Braid-HTTP implementation.
§Organization
constants/
├── Top-level - Common status codes (STATUS_SUBSCRIPTION, etc.)
├── status - All HTTP status codes used by Braid
├── headers - All Braid protocol header names (typed)
└── merge_types - Merge type identifiers§Status Codes
| Code | Constant | Description |
|---|---|---|
| 200 | status::OK | Standard response |
| 206 | status::PARTIAL_CONTENT | Range-based patches |
| 209 | STATUS_SUBSCRIPTION | Subscription update |
| 293 | STATUS_MERGE_CONFLICT | Version conflicts |
| 410 | STATUS_GONE | History dropped |
| 416 | STATUS_RANGE_NOT_SATISFIABLE | Invalid range |
§Examples
use crate::protocol;
use crate::protocol::constants::{headers, merge_types};
// Use top-level constants
let status = 209u16;
if status == protocol::STATUS_SUBSCRIPTION {
println!("Subscription response");
}
// Use module constants
if status == protocol::status::SUBSCRIPTION {
println!("Same as above");
}
// Use header name constants
let header_name = headers::VERSION;
assert_eq!(header_name, "Version");
// Use merge type constants
let merge_type = merge_types::DIAMOND;
assert_eq!(merge_type, "diamond");§Specification
See draft-toomim-httpbis-braid-http-04:
- Section 2: Versioning and merge types
- Section 3: Patches and Content-Range
- Section 4: Subscriptions and status codes
Modules§
- headers
- Braid protocol header names.
- media_
types - Braid protocol media types.
- merge_
types - Merge type identifiers for conflict resolution.
- status
- Standard HTTP status codes used by Braid-HTTP.
Constants§
- STATUS_
GONE - HTTP status code for history dropped (Section 4.5).
- STATUS_
MERGE_ CONFLICT - HTTP status code for merge conflicts (Section 2.2).
- STATUS_
RANGE_ NOT_ SATISFIABLE - HTTP status code for range not satisfiable.
- STATUS_
SUBSCRIPTION - HTTP status code for subscription updates (Section 4).