feat: use json verify json
This commit is contained in:
@@ -46,11 +46,9 @@ impl QuickJSContext {
|
||||
'_'
|
||||
}).collect();
|
||||
|
||||
// TODO check JSON valid
|
||||
// let v: Option<Vec<EmptyObject>> = serde_json::from_str(params).ok();
|
||||
// if v.is_none() {
|
||||
// return Err(rust_util::new_box_error("Params is not valid JSON array!"));
|
||||
// }
|
||||
if let Err(e) = json::parse(params) {
|
||||
return Err(rust_util::new_box_error(&format!("Params is not valid JSON array: {}", e)));
|
||||
}
|
||||
self.context.eval(&format!("__PUBLIC_{}.apply(null, {})", f, params)).map_err(|e| e.into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user