diff --git a/Cargo.lock b/Cargo.lock index 3586ad0..012ccb1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -580,7 +580,7 @@ dependencies = [ [[package]] name = "boltconn" -version = "0.10.0" +version = "0.10.1" dependencies = [ "aho-corasick", "anyhow", diff --git a/boltconn/Cargo.toml b/boltconn/Cargo.toml index b07778e..d4372a5 100644 --- a/boltconn/Cargo.toml +++ b/boltconn/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "boltconn" -version = "0.10.0" +version = "0.10.1" edition = "2021" readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/boltconn/src/intercept/script_engine.rs b/boltconn/src/intercept/script_engine.rs index d8d84dd..ed456ad 100644 --- a/boltconn/src/intercept/script_engine.rs +++ b/boltconn/src/intercept/script_engine.rs @@ -257,7 +257,7 @@ impl ScriptEngine { parts: &mut http::request::Parts, data: Option, ) -> Option { - if self.pattern.as_ref().map_or(true, |s| s.is_match(url)) { + if self.pattern.as_ref().is_none_or(|s| s.is_match(url)) { match self.script_type { ScriptType::Req | ScriptType::All => { let method = parts.method.to_string(); @@ -265,7 +265,7 @@ impl ScriptEngine { let (_, header, body) = self.run_js(url, data, method, None, header, "$request")?; parts.headers = header; - body.map(Bytes::from) + body } ScriptType::Resp => None, } @@ -281,7 +281,7 @@ impl ScriptEngine { parts: &mut http::response::Parts, data: Option, ) -> Option { - if self.pattern.as_ref().map_or(true, |s| s.is_match(url)) { + if self.pattern.as_ref().is_none_or(|s| s.is_match(url)) { match self.script_type { ScriptType::Req => None, ScriptType::Resp | ScriptType::All => { @@ -298,7 +298,7 @@ impl ScriptEngine { parts.status = status; } parts.headers = header; - body.map(Bytes::from) + body } } } else {