You can make an HTTP request with a custom body in HTML using the reqwest
library in Rust. Here's an example code snippet to do so:
main.rs332 chars14 lines
In this example, we create a new Client
from reqwest
, and then create an HTML body as a string. We then make a POST request to https://www.example.com
and set the body to be our HTML string. Finally, we print out the response body using println!()
.
Note that we are using the ?
operator to handle any errors that occur while making the request or parsing the response.
gistlibby LogSnag