File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -183,10 +183,8 @@ impl Request {
183183 /// string.
184184 #[ cfg( feature = "json-using-serde" ) ]
185185 pub fn with_json < T : serde:: ser:: Serialize > ( mut self , body : & T ) -> Result < Request , Error > {
186- self . headers . insert (
187- "Content-Type" . to_string ( ) ,
188- "application/json; charset=UTF-8" . to_string ( ) ,
189- ) ;
186+ self . headers
187+ . insert ( "Content-Type" . to_string ( ) , "application/json; charset=UTF-8" . to_string ( ) ) ;
190188 match serde_json:: to_string ( & body) {
191189 Ok ( json) => Ok ( self . with_body ( json) ) ,
192190 Err ( err) => Err ( Error :: SerdeJsonError ( err) ) ,
Original file line number Diff line number Diff line change @@ -24,11 +24,7 @@ fn test_json_using_serde() {
2424
2525 setup ( ) ;
2626 let original_json: serde_json:: Value = serde_json:: from_str ( JSON_SRC ) . unwrap ( ) ;
27- let response = bitreq:: post ( url ( "/echo" ) )
28- . with_json ( & original_json)
29- . unwrap ( )
30- . send ( )
31- . unwrap ( ) ;
27+ let response = bitreq:: post ( url ( "/echo" ) ) . with_json ( & original_json) . unwrap ( ) . send ( ) . unwrap ( ) ;
3228 let actual_json: serde_json:: Value = response. json ( ) . unwrap ( ) ;
3329 assert_eq ! ( & actual_json, & original_json) ;
3430}
You can’t perform that action at this time.
0 commit comments