If you call reqwest::Url::parse_with_params and give it an empty
parameter iterator, it still appends '?' to the URL, and then doesn't
put anything after it.
I don't _think_ that actually makes any difference, but it looks ugly.
More to the point, I noticed it while pasting HTTP transcripts to
report a bug in the Mastodon dev setup, and thought I'd better try
again without the spurious '?', in case it did make a difference.
let urlstr = self.auth.instance_url.clone() + "/api/v1/" +
&req.url_suffix;
- let url = match Url::parse_with_params(&urlstr, req.parameters.iter()) {
+ let parsed = if req.parameters.is_empty() {
+ Url::parse(&urlstr)
+ } else {
+ Url::parse_with_params(&urlstr, req.parameters.iter())
+ };
+ let url = match parsed {
Ok(url) => Ok(url),
Err(e) => Err(ClientError::UrlParseError(
urlstr.clone(), e.to_string())),