From 71dc92c133b3288a547471e72a10e295c5df787c Mon Sep 17 00:00:00 2001 From: Nikaidou Haruki Date: Mon, 1 Sep 2025 19:50:34 +0900 Subject: [PATCH] add generate url method --- ubw-sward/src/http/random.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ubw-sward/src/http/random.rs b/ubw-sward/src/http/random.rs index 958c358..8274183 100644 --- a/ubw-sward/src/http/random.rs +++ b/ubw-sward/src/http/random.rs @@ -1,6 +1,7 @@ use compact_str::CompactString; use rand::seq::IteratorRandom; use regex::Regex; +use url::Url; #[derive(Clone)] pub struct RandomUrlGenerator { @@ -89,6 +90,11 @@ impl RandomUrlGenerator { }, ) } + + pub fn generate_url(&mut self) -> Result { + let url = self.generate(); + Url::parse(&url) + } } #[derive(Debug, thiserror::Error)]