fix(torn-api): fix request parameter encoding
This commit is contained in:
parent
40913bc89b
commit
98073a37bd
|
@ -14,7 +14,13 @@ impl ApiRequest {
|
||||||
pub fn url(&self) -> String {
|
pub fn url(&self) -> String {
|
||||||
let mut url = format!("https://api.torn.com/v2{}?", self.path);
|
let mut url = format!("https://api.torn.com/v2{}?", self.path);
|
||||||
|
|
||||||
|
let mut first = true;
|
||||||
for (name, value) in &self.parameters {
|
for (name, value) in &self.parameters {
|
||||||
|
if first {
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
url.push('&');
|
||||||
|
}
|
||||||
url.push_str(&format!("{name}={value}"));
|
url.push_str(&format!("{name}={value}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue