mirror of https://github.com/rwf2/Rocket.git
Always log a request's 'format' when available.
This commit is contained in:
parent
46c721d3f5
commit
5a632a4d27
|
@ -638,9 +638,11 @@ impl<'r> fmt::Display for Request<'r> {
|
||||||
/// infrastructure.
|
/// infrastructure.
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{} {}", Paint::green(&self.method), Paint::blue(&self.uri))?;
|
write!(f, "{} {}", Paint::green(&self.method), Paint::blue(&self.uri))?;
|
||||||
if let Some(content_type) = self.content_type() {
|
|
||||||
if self.method.supports_payload() {
|
// Print the requests media type when the route specifies a format.
|
||||||
write!(f, " {}", Paint::yellow(content_type))?;
|
if let Some(media_type) = self.format() {
|
||||||
|
if !media_type.is_any() {
|
||||||
|
write!(f, " {}", Paint::yellow(media_type))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue