Skip to main content

tower_helmet/header/
origin_agent_cluster.rs

1use http::header::{HeaderName, InvalidHeaderValue};
2use http::HeaderValue;
3
4use crate::IntoHeader;
5
6/// `OriginAgentCluster` sets the `Origin-Agent-Cluster` header, which provides a mechanism to allow
7/// web applications to isolate their origins. Read more about it [in the spec](https://whatpr.org/html/6214/origin.html#origin-keyed-agent-clusters).
8pub struct OriginAgentCluster;
9
10impl Default for OriginAgentCluster {
11    fn default() -> Self {
12        OriginAgentCluster
13    }
14}
15
16impl IntoHeader for OriginAgentCluster {
17    fn header_name(&self) -> HeaderName {
18        HeaderName::from_static("origin-agent-cluster")
19    }
20
21    fn header_value(&self) -> Result<HeaderValue, InvalidHeaderValue> {
22        HeaderValue::from_str("?1")
23    }
24}