use the json method instead of the body method in the creation of the response

This commit is contained in:
Irevoire 2021-03-18 11:54:10 +01:00
parent 018cadc598
commit d4b1331a0a
No known key found for this signature in database
GPG Key ID: 7A6A970C96104F1B

View File

@ -10,5 +10,5 @@ pub fn services(cfg: &mut web::ServiceConfig) {
#[get("/health")]
async fn get_health() -> Result<HttpResponse, ResponseError> {
let payload = serde_json::json!({ "status": "available" });
Ok(HttpResponse::Ok().body(payload.to_string()))
Ok(HttpResponse::Ok().json(payload))
}