fix(core): reqwest 0.13 hat kein RequestBuilder::query -> Url::parse_with_params
CI / test (push) Successful in 11m40s
CI / test (push) Successful in 11m40s
This commit is contained in:
@@ -49,18 +49,19 @@ impl DtrackClient {
|
|||||||
self.get_query(path, &[]).await
|
self.get_query(path, &[]).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wie `get`, aber mit Query-Parametern, die reqwest sauber URL-encodet
|
/// Wie `get`, aber mit Query-Parametern. reqwest 0.13 hat kein
|
||||||
/// (z.B. fuer Namen mit Leerzeichen in `lookup_project`).
|
/// `RequestBuilder::query` mehr -- daher die URL ueber `Url::parse_with_params`
|
||||||
|
/// bauen; das encodet z.B. Leerzeichen in `lookup_project`-Namen sauber.
|
||||||
async fn get_query(&self, path: &str, params: &[(&str, &str)]) -> Result<String> {
|
async fn get_query(&self, path: &str, params: &[(&str, &str)]) -> Result<String> {
|
||||||
let url = format!("{}{}", self.base_url, path);
|
let url = reqwest::Url::parse_with_params(&format!("{}{}", self.base_url, path), params)
|
||||||
|
.with_context(|| format!("Ungueltige URL fuer {path}"))?;
|
||||||
let resp = self
|
let resp = self
|
||||||
.http
|
.http
|
||||||
.get(&url)
|
.get(url)
|
||||||
.header("X-Api-Key", &self.api_key)
|
.header("X-Api-Key", &self.api_key)
|
||||||
.query(params)
|
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("Request an {url} fehlgeschlagen"))?;
|
.with_context(|| format!("Request an {path} fehlgeschlagen"))?;
|
||||||
|
|
||||||
self.handle(path, resp).await
|
self.handle(path, resp).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user