@@ -40,7 +40,7 @@ impl HttpClient for Agent {
4040 let response = self
4141 . 0
4242 . run ( request)
43- . with_context ( ErrorKind :: Io , || "failed to send request" ) ?;
43+ . with_context_fn ( ErrorKind :: Io , || "failed to send request" ) ?;
4444
4545 into_response ( response)
4646 }
@@ -81,19 +81,19 @@ fn into_request(request: &Request) -> azure_core::Result<::http::Request<Vec<u8>
8181 . url ( )
8282 . as_str ( )
8383 . parse ( )
84- . with_context ( ErrorKind :: DataConversion , || "failed to parse url" ) ?;
84+ . with_context_fn ( ErrorKind :: DataConversion , || "failed to parse url" ) ?;
8585 * req. method_mut ( ) = request
8686 . method ( )
8787 . as_str ( )
8888 . parse ( )
89- . with_context ( ErrorKind :: DataConversion , || "failed to parse method" ) ?;
89+ . with_context_fn ( ErrorKind :: DataConversion , || "failed to parse method" ) ?;
9090 let headers = req. headers_mut ( ) ;
9191 for ( name, value) in request. headers ( ) . iter ( ) {
9292 headers. insert (
9393 HeaderName :: from_bytes ( name. as_str ( ) . as_bytes ( ) )
94- . with_context ( ErrorKind :: DataConversion , || "failed to parse header name" ) ?,
94+ . with_context_fn ( ErrorKind :: DataConversion , || "failed to parse header name" ) ?,
9595 HeaderValue :: from_bytes ( value. as_str ( ) . as_bytes ( ) )
96- . with_context ( ErrorKind :: DataConversion , || "failed to parse header value" ) ?,
96+ . with_context_fn ( ErrorKind :: DataConversion , || "failed to parse header value" ) ?,
9797 ) ;
9898 }
9999 let body: Bytes = request. body ( ) . into ( ) ;
@@ -120,13 +120,13 @@ fn into_response(response: ::http::Response<ureq::Body>) -> azure_core::Result<B
120120 name. as_str ( ) . to_ascii_lowercase ( ) ,
121121 value
122122 . to_str ( )
123- . with_context ( ErrorKind :: DataConversion , || "failed to parse header value" ) ?
123+ . with_context_fn ( ErrorKind :: DataConversion , || "failed to parse header value" ) ?
124124 . to_string ( ) ,
125125 ) ;
126126 }
127127 let body: Vec < u8 > = body
128128 . read_to_vec ( )
129- . with_context ( ErrorKind :: Io , || "failed to read response body" ) ?;
129+ . with_context_fn ( ErrorKind :: Io , || "failed to read response body" ) ?;
130130
131131 Ok ( BufResponse :: from_bytes ( status, response_headers, body) )
132132}
0 commit comments