Skip to content

Commit

Permalink
Avoid panic on receiving a binary encoded message
Browse files Browse the repository at this point in the history
  • Loading branch information
atomic77 committed Mar 28, 2021
1 parent 346b444 commit e5e326c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ pub fn handle_req(request: &mut Request, app_ctx: &mut AppContext) -> Response<C
let url = base_url.join(request.url()).unwrap();

let mut body = String::new();
request.as_reader().read_to_string(&mut body).unwrap();
if let Err(e) = request.as_reader().read_to_string(&mut body) {
body = format!("Could not parse request body - is this a binary format? {:?}", e);
}

let sr = StoredRequest {
time: Utc::now().to_rfc2822(),
Expand Down

0 comments on commit e5e326c

Please sign in to comment.