Complete these tasks to reinforce what you learned in this module.
Using reqwest::Client, send a GET request to https://httpbin.org/get, await the response, and print the status code (e.g. 200). Use #[tokio::main] and handle errors with ?.
reqwest::Client, call .get(url).send().await, then inspect the response’s status. Use #[tokio::main] and handle errors.// Task 1: GET and print status. See tasks/TASKS.md.
fn main() {
todo!("reqwest GET https://httpbin.org/get, print status");
}
Send a POST request to https://httpbin.org/post with a JSON body {"name": "Rust"}. Use .json(&value) where value is a struct with Serialize. Await the response and print the response body as text (or the first 100 chars). Use reqwest::Client and #[tokio::main].
Serialize for the body; the .json() method sets the body and Content-Type. After send().await, get the response body as text.// Task 2: POST JSON and read body. See tasks/TASKS.md.
fn main() {
todo!("reqwest POST with JSON body, print response");
}