summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-04-11 12:47:11 +0100
committerKornel <kornel@geekhood.net>2020-04-11 12:47:11 +0100
commit4b1884b48efc673a2c36a88a45029ba1bd538148 (patch)
tree420659eb0c68b306c798b8f3531511d8ea27a66f
parentdef448d36d8f718785da3a0001194399617b3990 (diff)
Escape arg
-rw-r--r--github_v3/Cargo.toml7
-rw-r--r--github_v3/src/lib.rs5
2 files changed, 10 insertions, 2 deletions
diff --git a/github_v3/Cargo.toml b/github_v3/Cargo.toml
index d4192f9..5f5247c 100644
--- a/github_v3/Cargo.toml
+++ b/github_v3/Cargo.toml
@@ -3,9 +3,13 @@ name = "github_v3"
description = "Async GitHub API v3 client"
version = "0.3.1"
authors = ["Kornel <kornel@geekhood.net>"]
-keywords = ["github", "rest-api", "async"]
+keywords = ["github", "restful", "api", "async"]
categories = ["web-programming", "web-programming::http-client"]
edition = "2018"
+readme = "README.md"
+repository = "https://gitlab.com/crates.rs/crates.rs/-/tree/master/github_v3"
+homepage = "https://lib.rs/github_v3"
+license = "CC0-1.0"
[dependencies]
reqwest = { version = "0.10.1", features = ["json"] }
@@ -16,6 +20,7 @@ serde_derive = "1.0.104"
futures = "0.3.4"
async-stream = "0.2.1"
tokio = { version = "0.2.11", features = ["time"] }
+urlencoding = "1.0.0"
[dev-dependencies]
tokio = { version = "0.2.11", features = ["rt-threaded", "macros", "time"] }
diff --git a/github_v3/src/lib.rs b/github_v3/src/lib.rs
index 4fb75bb..b13fa96 100644
--- a/github_v3/src/lib.rs
+++ b/github_v3/src/lib.rs
@@ -64,9 +64,12 @@ impl Builder {
self
}
+ /// Add a user-supplied argument to the request path, e.g. `.path("users").arg(username)`
+ ///
+ /// The arg is URL-escaped, so it's safe to use any user-supplied data.
pub fn arg(mut self, arg: &str) -> Self {
self.url.push('/');
- self.url.push_str(arg);
+ self.url.push_str(&urlencoding::encode(arg));
self
}