oa_gateway_stomp

Function sniff_content_type

Source
pub fn sniff_content_type(payload: &[u8], header: Option<&str>) -> ContentType
Expand description

MIME type from a STOMP content-type header, or a sniff of the body.

The header wins when its type (before ;) is non-empty. Otherwise a leading { is JSON, a leading < is XML, and everything else is application/octet-stream. Does not fail.