Last active
March 29, 2019 23:37
-
-
Save rjloura/6876d6e4da00b740159884d3f9d92ffd to your computer and use it in GitHub Desktop.
How to add get query params to hyper.rs URL
This file contains hidden or 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
extern crate url; | |
extern create hyper; | |
use url::Url; | |
use hyper::{Client, Uri}; | |
let mut url = Url::parse("http://api.openweathermap.org/data/2.5/weather").unwrap(); | |
url.query_pairs_mut() | |
.append_pair("q", "some query") | |
.append_pair("p", "some other query); | |
let uri = url.as_str().parse::<Uri>().unwrap(); | |
let client = Client::new(); | |
client.get(uri) | |
.and_then()... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment