MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / post_question

Function post_question

ch_11/integration-tests/src/main.rs:142–162  ·  view source on GitHub ↗
(token: Token)

Source from the content-addressed store, hash-verified

140}
141
142async fn post_question(token: Token) {
143 let q = Question {
144 title: "First Question".to_string(),
145 content: "How can I test?".to_string(),
146 };
147
148 let client = reqwest::Client::new();
149 let res = client
150 .post("http://localhost:3030/questions")
151 .header("Authorization", token.0)
152 .json(&q)
153 .send()
154 .await
155 .unwrap()
156 .json::<QuestionAnswer>()
157 .await
158 .unwrap();
159
160 assert_eq!(res.id, 1);
161 assert_eq!(res.title, q.title);
162}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected