grafbase_sdk/host/headers.rs
1use crate::wit;
2
3/// HTTP headers. Will be the gateway headers for authentication/authorization extensions and
4/// the subgraph headers for resolvers.
5pub struct Headers(wit::Headers);
6
7impl From<wit::Headers> for Headers {
8 fn from(headers: wit::Headers) -> Self {
9 Self(headers)
10 }
11}
12
13impl Headers {
14 /// Get the header value for the specified header name.
15 pub fn get(&self, name: &str) -> Option<String> {
16 self.0.get(name)
17 }
18
19 /// Get all header entries.
20 pub fn entries(&self) -> Vec<(String, String)> {
21 self.0.entries()
22 }
23}