File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,6 @@ impl<T> Response<T> {
40
40
#[ track_caller]
41
41
// TODO: Rename to into_json()
42
42
pub fn json ( mut self ) -> Value {
43
- assert_eq ! (
44
- self . response
45
- . headers( )
46
- . get( header:: CONTENT_TYPE )
47
- . expect( "Missing content-type header" ) ,
48
- "application/json; charset=utf-8"
49
- ) ;
50
43
json ( & mut self . response )
51
44
}
52
45
96
89
File ( _) => unimplemented ! ( ) ,
97
90
} ;
98
91
92
+ assert_eq ! (
93
+ r. headers( )
94
+ . get( header:: CONTENT_TYPE )
95
+ . expect( "Missing content-type header" ) ,
96
+ "application/json; charset=utf-8"
97
+ ) ;
98
+
99
+ assert_eq ! (
100
+ r. headers( )
101
+ . get( header:: CONTENT_LENGTH )
102
+ . expect( "Missing content-length header" )
103
+ . to_str( )
104
+ . unwrap( )
105
+ . parse( ) ,
106
+ Ok ( body. len( ) )
107
+ ) ;
108
+
99
109
let s = std:: str:: from_utf8 ( & body) . unwrap ( ) ;
100
110
match serde_json:: from_str ( s) {
101
111
Ok ( t) => t,
You can’t perform that action at this time.
0 commit comments