diff --git a/Cargo.toml b/Cargo.toml index 65ea032..99ef87d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ travis-ci = { repository = "lipanski/mockito", branch = "master" } appveyor = { repository = "lipanski/mockito", branch = "master", service = "github" } [dependencies] -rand = "0.7.0" +rand = "0.8" httparse = "1.3.3" regex = "1.0.5" lazy_static = "1.1.0" diff --git a/src/lib.rs b/src/lib.rs index 9e90121..a9eb6bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -951,7 +951,11 @@ pub struct Mock { impl Mock { fn new>(method: &str, path: P) -> Self { Self { - id: thread_rng().sample_iter(&Alphanumeric).take(24).collect(), + id: thread_rng() + .sample_iter(&Alphanumeric) + .map(char::from) + .take(24) + .collect(), method: method.to_owned().to_uppercase(), path: PathAndQueryMatcher::Unified(path.into()), headers: Vec::new(), diff --git a/tests/lib.rs b/tests/lib.rs index f3f003a..e54eccd 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -797,6 +797,7 @@ fn test_all_of_missing_match_header() { fn test_large_utf8_body() { let mock_body: String = rand::thread_rng() .sample_iter(&Alphanumeric) + .map(char::from) .take(3 * 1024) // Must be larger than the request read buffer .collect();