Last active
June 9, 2022 17:50
-
-
Save mr-pascal/19c62b2988d2bf8a0d88282fe7c01cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//... | |
// - 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