Skip to main content
Glama
header.rs1.77 kB
use si_data_nats::{ HeaderMap, HeaderValue, Subject, async_nats, header::IntoHeaderValue, }; pub mod value; // X-CONTENT-ENCODING: gzip pub const CONTENT_ENCODING: &str = "X-CONTENT-ENCODING"; // X-CONTENT-TYPE: application/json pub const CONTENT_TYPE: &str = "X-CONTENT-TYPE"; // X-MESSAGE-TYPE: EnqueueRequest pub const MESSAGE_TYPE: &str = "X-MESSAGE-TYPE"; // X-MESSAGE-VERSION: 1 pub const MESSAGE_VERSION: &str = "X-MESSAGE-VERSION"; // X-REPLY-INBOX: _INBOX.3wJ4MnwZ8xRSBAaTbwa2t6 pub const REPLY_INBOX: &str = "X-Reply-Inbox"; #[inline] pub fn insert_content_encoding(headers: &mut HeaderMap, value: impl IntoHeaderValue) { headers.insert(CONTENT_ENCODING, value); } #[inline] pub fn content_encoding(maybe_headers: Option<&HeaderMap>) -> Option<&HeaderValue> { maybe_headers.and_then(|headers| headers.get(CONTENT_ENCODING)) } #[inline] pub fn content_encoding_is(maybe_headers: Option<&HeaderMap>, check: &'static str) -> bool { maybe_headers .and_then(|headers| headers.get(CONTENT_ENCODING)) .map(|val| val.as_str() == check) .unwrap_or(false) } #[inline] pub fn insert_content_type(headers: &mut HeaderMap, value: impl IntoHeaderValue) { headers.insert(CONTENT_TYPE, value); } #[inline] pub fn insert_nats_msg_id(headers: &mut HeaderMap, value: impl IntoHeaderValue) { headers.insert(async_nats::header::NATS_MESSAGE_ID, value); } #[inline] pub fn insert_reply_inbox(headers: &mut HeaderMap, reply_inbox: &str) { headers.insert(REPLY_INBOX, reply_inbox); } #[inline] pub fn insert_maybe_reply_inbox(headers: &mut HeaderMap, maybe_reply_inbox: Option<&Subject>) { if let Some(reply_inbox) = maybe_reply_inbox { headers.insert(REPLY_INBOX, reply_inbox.as_str()); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server