From 5a632a4d27feb9b79ac09ab5705f41a9d49aa3e3 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 11 Jul 2017 04:35:05 -0700 Subject: [PATCH] Always log a request's 'format' when available. --- lib/src/request/request.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/request/request.rs b/lib/src/request/request.rs index 477ed1b2..95ceb1ce 100644 --- a/lib/src/request/request.rs +++ b/lib/src/request/request.rs @@ -638,9 +638,11 @@ impl<'r> fmt::Display for Request<'r> { /// infrastructure. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} {}", Paint::green(&self.method), Paint::blue(&self.uri))?; - if let Some(content_type) = self.content_type() { - if self.method.supports_payload() { - write!(f, " {}", Paint::yellow(content_type))?; + + // Print the requests media type when the route specifies a format. + if let Some(media_type) = self.format() { + if !media_type.is_any() { + write!(f, " {}", Paint::yellow(media_type))?; } }