Transaction a01e927bddec1e247b26a1e02c8a90a842c25865c9019f55bd569f4694e91ea4
1 Input
-
a762ef7b3af2c90f6469b348afd5fdc7474d083d991bee956c9466e75774330a:13
OP_DATA_32(32) b76158ebef90aea2ebeb6f6030531a8ddfbedc5c11b520144c0ee58255ab6668OP_CHECKSIG(172)OP_0(0)OP_IF(99)OP_DATA_3(3) ordOP_DATA_1(1)OP_DATA_24(24) text/plain;charset=utf-8OP_0(0)OP_PUSHDATA2(77) use {super::*, axum::extract::FromRef}; #[derive(Default)] pub(crate) struct AcceptEncoding(Option<String>); #[async_trait::async_trait] impl<S> axum::extract::FromRequestParts<S> for AcceptEncoding where Arc<ServerConfig>: FromRef<S>, S: Send + Sync, { type Rejection = (StatusCode, &'static str); async fn from_request_parts( parts: &mut http::request::Parts, _state: &S, ) -> Result<Self, Self::Rejection> { Ok(Self( parts .headers .get("accept-encoding") .map(|OP_PUSHDATA2(77) value| value.to_str().unwrap_or_default().to_owned()), )) } } impl AcceptEncoding { pub(crate) fn is_acceptable(&self, encoding: &HeaderValue) -> bool { let Ok(encoding) = encoding.to_str() else { return false; }; self .0 .clone() .unwrap_or_default() .split(',') .any(|value| value.split(';').next().unwrap_or_default().trim() == encoding) } } #[cfg(test)] mod tests { use { super::*, axum::{extract::FromRequestParts, http::Request},OP_ENDIF(104)
1 Outputs
- a01e927bddec1e247b26a1e02c8a90a842c25865c9019f55bd569f4694e91ea4:0
value 331
address bc1p255wkz72v63tkjayhmprhjjvhhwg4d4nxjtt3k8vexf8hh3l226sqpwul2