Created
September 18, 2020 21:06
-
-
Save saidaspen/62eead1aed4ddf618d14a09bead6876f to your computer and use it in GitHub Desktop.
Type annotation?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[post("/new")] | |
async fn new(req_body: String) -> impl Responder { | |
match serde_json::from_str(req_body.as_str()) { | |
Err(why) => HttpResponse::BadRequest().body( | |
json!({ | |
"err": "Unable to parse input as request json", | |
}) | |
.to_string(), | |
), | |
Ok(t) => HttpResponse::Ok().body(format!("{:?}", t)), | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error: