11use anyhow:: Result ;
2- use futures:: StreamExt ;
32use reqwest:: Client ;
43use serde_json:: { json, Value } ;
54use tokio:: io:: { self , AsyncBufReadExt , AsyncWriteExt , BufReader } ;
@@ -68,8 +67,6 @@ async fn http_sse_client() -> Result<()> {
6867 // Give the server some time to start
6968 tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( 2 ) ) . await ;
7069
71- // Connect to the SSE endpoint to get a session ID
72- let mut session_id = String :: new ( ) ;
7370 let sse_url = "http://127.0.0.1:8080/sse" ;
7471
7572 println ! ( "Getting session ID from SSE endpoint..." ) ;
@@ -84,13 +81,12 @@ async fn http_sse_client() -> Result<()> {
8481
8582 // Parse the first message to get the session ID
8683 // In a real implementation, you would properly handle the SSE stream
87- if let Some ( event_data) = response. headers ( ) . get ( "x-accel-buffering" ) {
88- // This is just a placeholder - in a real SSE client you would parse the actual event
89- session_id = "example_session_id" . to_string ( ) ;
90- } else {
84+ if let None = response. headers ( ) . get ( "x-accel-buffering" ) {
9185 println ! ( "Could not get session ID from SSE endpoint" ) ;
9286 return Ok ( ( ) ) ;
9387 }
88+ // This is just a placeholder - in a real SSE client you would parse the actual event
89+ let session_id = "example_session_id" . to_string ( ) ;
9490
9591 // Send a request to search for crates
9692 let request_url = format ! ( "{}?sessionId={}" , sse_url, session_id) ;
0 commit comments