Skip to content

Instantly share code, notes, and snippets.

@mr-pascal
Last active June 9, 2022 17:50
Show Gist options
  • Save mr-pascal/19c62b2988d2bf8a0d88282fe7c01cba to your computer and use it in GitHub Desktop.
Save mr-pascal/19c62b2988d2bf8a0d88282fe7c01cba to your computer and use it in GitHub Desktop.
//...
// - Doing a GET request
// - Parse the response to the "GETAPIResponse" struct
let resp200 = client.get("https://httpbin.org/ip")
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json::<GETAPIResponse>()
.await?;
println!("{:#?}", resp200);
// Output:
/*
GETAPIResponse {
origin: "182.190.14.159",
}
*/
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment