Error with json
This commit is contained in:
parent
7fe27c210c
commit
9109cabc83
|
|
@ -1206,7 +1206,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rasp_mgr"
|
||||
version = "2.0.2"
|
||||
version = "2.0.3"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"clap",
|
||||
|
|
|
|||
|
|
@ -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 <piyush.raj.kit@gmail.com>"]
|
||||
license = "GPL-3.0-only"
|
||||
|
|
|
|||
6
api.http
6
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
|
||||
content-length: 30
|
||||
content-type: application/json
|
||||
date: Fri, 24 Dec 2021 16:05:03 GMT
|
||||
|
|
@ -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)
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in New Issue