Skip to content

Commit

Permalink
Merge pull request #133 from EmbarkStudios/update-rand
Browse files Browse the repository at this point in the history
Update rand to 0.8
  • Loading branch information
lipanski committed Jan 11, 2021
2 parents 4a88719 + 7ea34ab commit 61c938d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,11 @@ pub struct Mock {
impl Mock {
fn new<P: Into<Matcher>>(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(),
Expand Down
1 change: 1 addition & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 61c938d

Please sign in to comment.