Skip to content

Commit

Permalink
fix: Fix response body: from string to json
Browse files Browse the repository at this point in the history
  • Loading branch information
sousandrei committed Sep 17, 2022
1 parent 6010f31 commit bd4a9b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/api/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
return Ok(response);
};

let response = super::build_response(StatusCode::OK, String::from("Success"));
let response = super::build_response(
StatusCode::OK,
serde_json::json!({
"success": true,
})
.to_string(),
);
Ok(response)
}
8 changes: 7 additions & 1 deletion src/api/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
return Ok(response);
};

let response = super::build_response(StatusCode::OK, format!("Success"));
let response = super::build_response(
StatusCode::OK,
serde_json::json!({
"sucess": true,
})
.to_string(),
);
Ok(response)
}
8 changes: 7 additions & 1 deletion src/api/kill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ pub async fn handler(request: Request<Body>, state: State) -> Result<Response<Bo
return Ok(response);
};

let response = build_response(StatusCode::OK, String::from("Success"));
let response = build_response(
StatusCode::OK,
serde_json::json!({
"sucess": true,
})
.to_string(),
);
Ok(response)
}

0 comments on commit bd4a9b2

Please sign in to comment.