Querystring with a vector not handled properly #2854
-
|
Hey, so I need to provide a list of query parameters where some can be passed multiple times. The status-quo seems to be a widely used convention but not formally standardised. However a useful feature nonetheless. Unfortunately Concrete code example: let req = match api.get("https://api.open-meteo.com/v1/forecast")
.query(serde_json::json! {{
"latitude": 0.0,
"longitude": 0.0,
"hourly": ["temperature_2m", "rain", "precipitation", "wind_speed_10m"]
}})
.header("Accept", "application/json")
.send()
.await {
Ok(req) => req,
Err(err) => {
log::error!("Reqwest Error: {err:?}");
return Err(std::io::Error::other(err));
}
};
let res = match req.json::<serde_json::Value>().await {
Ok(res) => res,
Err(err) => {
log::error!("Response Error: {err:?}");
return Err(std::io::Error::other(err))
}
};This code compiles but produces an error saying the repeated hourly parameter is not supported. Here's a Rust Playground link. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey there! While it might not be that hard, I'd rather not make the change. See previously for why: |
Beta Was this translation helpful? Give feedback.
Hey there! While it might not be that hard, I'd rather not make the change. See previously for why: