@@ -250,14 +250,16 @@ pub use reqwest::{header::HeaderMap, StatusCode};
250250pub struct Response < T > {
251251 pub status : reqwest:: StatusCode ,
252252 pub headers : reqwest:: header:: HeaderMap ,
253+ pub extensions : http:: Extensions ,
253254 pub body : T ,
254255}
255256
256257impl < T > Response < T > {
257- pub fn new ( status : reqwest:: StatusCode , headers : reqwest:: header:: HeaderMap , body : T ) -> Self {
258+ pub fn new ( status : reqwest:: StatusCode , headers : reqwest:: header:: HeaderMap , extensions : http :: Extensions , body : T ) -> Self {
258259 Self {
259260 status,
260261 headers,
262+ extensions,
261263 body,
262264 }
263265 }
@@ -663,6 +665,7 @@ impl Client {
663665
664666 let status = response. status ( ) ;
665667 let headers = response. headers ( ) . clone ( ) ;
668+ let extensions = response. extensions ( ) . to_owned ( ) ;
666669 let link = response
667670 . headers ( )
668671 . get ( http:: header:: LINK )
@@ -698,7 +701,7 @@ impl Client {
698701 } ;
699702 Ok ( (
700703 next_link,
701- crate :: Response :: new ( status, headers, parsed_response) ,
704+ crate :: Response :: new ( status, headers, extensions , parsed_response) ,
702705 ) )
703706 } else if status. is_redirection ( ) {
704707 match status {
@@ -716,7 +719,7 @@ impl Client {
716719 . lookup_next_link ( & uri)
717720 . map ( |next_link| next_link. map ( crate :: utils:: NextLink ) ) ,
718721 } ;
719- link. map ( |link| ( link, Response :: new ( status, headers, out) ) )
722+ link. map ( |link| ( link, Response :: new ( status, headers, extensions , out) ) )
720723 }
721724 #[ cfg( not( feature = "httpcache" ) ) ]
722725 {
@@ -734,7 +737,7 @@ impl Client {
734737 serde_json:: from_slice :: < Out > ( & response_body) ?
735738 } ;
736739
737- Ok ( ( None , crate :: Response :: new ( status, headers, body) ) )
740+ Ok ( ( None , crate :: Response :: new ( status, headers, extensions , body) ) )
738741 }
739742 }
740743 } else {
@@ -974,6 +977,7 @@ impl Client {
974977 Ok ( Response :: new (
975978 response. status ,
976979 response. headers ,
980+ response. extensions . to_owned ( ) ,
977981 global_items,
978982 ) )
979983 }
0 commit comments