diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-12-12 00:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 00:36:18 +0100 |
commit | 31935c6b8d8f763a5cf809b940427024da01a71c (patch) | |
tree | 7e35a4b806570c40dd0eae8378db77be12335ace /cli/inspector.rs | |
parent | 39c86df4e587bf45e446bd944bff4a91b8a63be3 (diff) |
refactor(cli): more options on Worker (#8724)
Diffstat (limited to 'cli/inspector.rs')
-rw-r--r-- | cli/inspector.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cli/inspector.rs b/cli/inspector.rs index fa1bfa2d0..89fd5bf57 100644 --- a/cli/inspector.rs +++ b/cli/inspector.rs @@ -52,7 +52,7 @@ pub struct InspectorServer { } impl InspectorServer { - pub fn new(host: SocketAddr) -> Self { + pub fn new(host: SocketAddr, name: String) -> Self { let (register_inspector_tx, register_inspector_rx) = mpsc::unbounded::<InspectorInfo>(); @@ -63,6 +63,7 @@ impl InspectorServer { host, register_inspector_rx, shutdown_server_rx, + name, )) }); @@ -145,6 +146,7 @@ async fn server( host: SocketAddr, register_inspector_rx: UnboundedReceiver<InspectorInfo>, shutdown_server_rx: oneshot::Receiver<()>, + name: String, ) { // TODO: put the `inspector_map` in an `Rc<RefCell<_>>` instead. This is // currently not possible because warp requires all filters to implement @@ -199,13 +201,13 @@ async fn server( ) }); - let json_version_route = warp::path!("json" / "version").map(|| { - warp::reply::json(&json!({ - "Browser": format!("Deno/{}", crate::version::deno()), - "Protocol-Version": "1.3", - "V8-Version": deno_core::v8_version(), - })) + let json_version_response = json!({ + "Browser": name, + "Protocol-Version": "1.3", + "V8-Version": deno_core::v8_version(), }); + let json_version_route = warp::path!("json" / "version") + .map(move || warp::reply::json(&json_version_response)); let inspector_map_ = inspector_map.clone(); let json_list_route = warp::path("json").map(move || { |