File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,9 @@ impl Handler for Middleware {
37
37
38
38
// Second, if we're requesting html, then we've only got one page so
39
39
// serve up that page. Otherwise proxy on to the rest of the app.
40
- let wants_html = {
41
- let content = req. headers ( ) . find ( "Accept" ) . unwrap_or ( Vec :: new ( ) ) ;
42
- content. iter ( ) . any ( |s| s. contains ( "html" ) )
43
- } ;
40
+ let wants_html = req. headers ( ) . find ( "Accept" ) . map ( |accept| {
41
+ accept. iter ( ) . any ( |s| s. contains ( "html" ) )
42
+ } ) . unwrap_or ( true ) ; // If no Accept header is specified, serve up html.
44
43
if wants_html {
45
44
self . dist . call ( & mut RequestProxy {
46
45
other : req,
Original file line number Diff line number Diff line change @@ -93,8 +93,9 @@ impl<'a> RequestUtils for Request + 'a {
93
93
}
94
94
95
95
fn wants_json ( & self ) -> bool {
96
- let content = self . headers ( ) . find ( "Accept" ) . unwrap_or ( Vec :: new ( ) ) ;
97
- content. iter ( ) . any ( |s| s. contains ( "json" ) )
96
+ self . headers ( ) . find ( "Accept" ) . map ( |accept| {
97
+ accept. iter ( ) . any ( |s| s. contains ( "json" ) )
98
+ } ) . unwrap_or ( false )
98
99
}
99
100
100
101
fn pagination ( & self , default : usize , max : usize ) -> CargoResult < ( i64 , i64 ) > {
You can’t perform that action at this time.
0 commit comments