Here's an example on how to make an HTTP Post request with a custom body in Rust using the reqwest
crate:
main.rs295 chars12 lines
In this example, we create a reqwest::Client
and use the post()
method to specify the HTTP method and the endpoint URL. We then use the body()
method to set the request body to our custom string. Finally, we call the send()
method to send the request and get the response.
Note that the body()
method accepts any type that implements the Into<Body>
trait. This means that we can also use other types of request bodies, such as JSON or binary data.
gistlibby LogSnag