@@ -198,25 +198,9 @@ impl OpenAIClient {
198
198
path : & str ,
199
199
body : & impl serde:: ser:: Serialize ,
200
200
) -> Result < T , APIError > {
201
- let request_builder = self . build_request ( Method :: POST , path) . await ;
202
- let body_json = serde_json:: to_string ( body) . map_err ( |e| APIError :: CustomError {
203
- message : format ! ( "Failed to serialize body: {}" , e) ,
204
- } ) ?;
205
- let request_builder = request_builder. json ( body) ;
206
-
207
- // 💡 Convert to request to inspect it before sending
208
- let client = request_builder
209
- . try_clone ( )
210
- . expect ( "Cannot clone request builder" )
211
- . build ( )
212
- . expect ( "Failed to build request" ) ;
213
-
214
- // 🔍 Debug log: URL, headers, and optionally body
215
- tracing:: info!( "🔵 URL: {}" , client. url( ) ) ;
216
- tracing:: info!( "🟢 Headers:\n {:#?}" , client. headers( ) ) ;
217
- tracing:: info!( "🔴 Body:\n {:#?}" , body_json) ;
218
- let response = request_builder. send ( ) . await ?;
219
- tracing:: info!( "Response: {:?}" , response) ;
201
+ let request = self . build_request ( Method :: POST , path) . await ;
202
+ let request = request. json ( body) ;
203
+ let response = request. send ( ) . await ?;
220
204
self . handle_response ( response) . await
221
205
}
222
206
0 commit comments