feat: update container

This commit is contained in:
2022-07-23 13:03:43 +08:00
parent c40ac23cf5
commit 46b730e235
3 changed files with 15 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
use boa_engine::{Context, JsResult, JsString, JsValue};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
wit_bindgen_rust::export!("../exports.wit");
wit_bindgen_rust::import!("../container.wit");
@@ -31,7 +32,7 @@ fn do_fetch(_: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResult<JsValu
let mut fetch_params_map = Map::new();
fetch_params_map.insert("url".to_string(), args[0].to_json(ctx).expect("error"));
if args.len() > 1 {
fetch_params_map.insert("params".to_string(), args[1].to_json(ctx).expect("error"));
fetch_params_map.insert("options".to_string(), args[1].to_json(ctx).expect("error"));
}
let fetch_params = format!("{}", Value::Object(fetch_params_map));