diff --git a/Cargo.lock b/Cargo.lock index 1ff2a13..d722c92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1206,7 +1206,7 @@ dependencies = [ [[package]] name = "rasp_mgr" -version = "2.0.2" +version = "2.0.3" dependencies = [ "async-std", "clap", diff --git a/Cargo.toml b/Cargo.toml index 619bdaa..2aeee4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rasp_mgr" -version = "2.0.2" +version = "2.0.3" description = "A simple server manager for local newtrok" authors = ["PiyushXCoder "] license = "GPL-3.0-only" diff --git a/api.http b/api.http index 98c09a6..8554cba 100644 --- a/api.http +++ b/api.http @@ -28,6 +28,6 @@ date: Fri, 24 Dec 2021 15:48:27 GMT GET http://0.0.0.0:8080/exec/random HTTP/1.1 400 - Bad Request -content-length: 16 -content-type: text/plain;charset=utf-8 -date: Fri, 24 Dec 2021 15:57:38 GMT \ No newline at end of file +content-length: 30 +content-type: application/json +date: Fri, 24 Dec 2021 16:05:03 GMT \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index e3253f9..e14b6a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,7 @@ async fn main() -> tide::Result<()> { app.with(After(|mut res: Response| async move { if let Some(err) = res.downcast_error::<&str>() { let err = err.to_owned(); - res.set_body(err); + res.set_body(json!({ "message": err })); } Ok(res) }));