From f4ef3bbd187ecf214e15292853a5eacb7356c980 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Mon, 22 Jun 2020 14:43:46 -0700 Subject: [PATCH] Server: remove default body behavior for errors This is probably never what a Tide user wants. The developer of a server can use the log middleware, otherwise this presents a risk as it may point to potentially exploitable flaws. Additionally, Tide can't completely aguarentee this will be in an expected format. --- src/server.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/server.rs b/src/server.rs index f93174c12..4e09c5bb5 100644 --- a/src/server.rs +++ b/src/server.rs @@ -427,22 +427,7 @@ impl Server { next_middleware: &middleware, }; - let mut res = next.run(req).await; - if res.len().is_some() { - let res: http_types::Response = res.into(); - return Ok(res.into()); - } - - if let Some(err) = res.error() { - // Only send the message if it is a non-500 range error. All - // errors default to 500 by default, so sending the error - // body is opt-in at the call site. - if !err.status().is_server_error() { - let msg = err.to_string(); - res.set_body(msg); - } - } - + let res = next.run(req).await; let res: http_types::Response = res.into(); Ok(res.into()) }