MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / http1_get

Function http1_get

crates/openshell-server/src/multiplex.rs:865–887  ·  view source on GitHub ↗
(
        addr: std::net::SocketAddr,
        path: &str,
        headers: &[(&str, &str)],
    )

Source from the content-addressed store, hash-verified

863 }
864
865 async fn http1_get(
866 addr: std::net::SocketAddr,
867 path: &str,
868 headers: &[(&str, &str)],
869 ) -> Response<Incoming> {
870 let stream = tokio::net::TcpStream::connect(addr).await.unwrap();
871 let (mut sender, conn) = hyper::client::conn::http1::Builder::new()
872 .handshake(TokioIo::new(stream))
873 .await
874 .unwrap();
875 tokio::spawn(async move {
876 let _ = conn.await;
877 });
878
879 let mut builder = Request::builder()
880 .method("GET")
881 .uri(format!("http://{addr}{path}"));
882 for (k, v) in headers {
883 builder = builder.header(*k, *v);
884 }
885 let req = builder.body(Empty::<Bytes>::new()).unwrap();
886 sender.send_request(req).await.unwrap()
887 }
888
889 #[tokio::test]
890 async fn http_response_includes_request_id() {

Calls 3

connectFunction · 0.85
send_requestMethod · 0.80
spawnFunction · 0.50

Tested by

no test coverage detected