Skip to main content

extension_accepted

Function extension_accepted 

Source
pub fn extension_accepted(header: Option<&str>) -> bool
Available on crate feature compression only.
Expand description

True when a handshake header value (e.g. the integrator’s custom capability header) offers EXTENSION_NAME.

Matching is case-insensitive, token-exact, comma-separated — the same shape as Sec-WebSocket-Extensions. Absent header → false.

use ws_kit::compression::{extension_accepted, EXTENSION_NAME};

assert!(extension_accepted(Some("x-ws-kit-deflate")));
assert!(extension_accepted(Some("permessage-deflate, X-WS-KIT-DEFLATE")));
assert!(!extension_accepted(Some("permessage-deflate")));
assert!(!extension_accepted(None));