MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / request_test

Function request_test

crates/chat-cli/src/request.rs:87–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86 #[tokio::test]
87 async fn request_test() {
88 let mut server = mockito::Server::new_async().await;
89 let mock = server
90 .mock("GET", "/hello")
91 .with_status(200)
92 .with_header("content-type", "text/plain")
93 .with_body("world")
94 .create();
95 let url = server.url();
96
97 let client = new_client().unwrap();
98 let res = client.get(format!("{url}/hello")).send().await.unwrap();
99 assert_eq!(res.status(), 200);
100 assert_eq!(res.headers()["content-type"], "text/plain");
101 assert_eq!(res.text().await.unwrap(), "world");
102
103 mock.expect(1).assert();
104 }
105}

Callers

nothing calls this directly

Calls 4

new_clientFunction · 0.85
urlMethod · 0.45
sendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected