Skip to content

Commit d814f41

Browse files
authored
Merge pull request #45 from hatoo/parse-url
Parse URL on clap
2 parents e47e963 + 5819730 commit d814f41

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl std::str::FromStr for ParseDuration {
2121
#[structopt(version = clap::crate_version!(), author = clap::crate_authors!(), about = "Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation.", global_setting = clap::AppSettings::DeriveDisplayOrder)]
2222
struct Opts {
2323
#[structopt(help = "Target URL.")]
24-
url: String,
24+
url: Url,
2525
#[structopt(
2626
help = "Number of requests to run.",
2727
short = "n",
@@ -146,7 +146,6 @@ impl Request {
146146
#[tokio::main]
147147
async fn main() -> anyhow::Result<()> {
148148
let mut opts: Opts = Opts::from_args();
149-
let url = Url::parse(opts.url.as_str())?;
150149
let client = {
151150
// Various settings for client here.
152151
let mut client_builder = reqwest::ClientBuilder::new();
@@ -288,7 +287,7 @@ async fn main() -> anyhow::Result<()> {
288287

289288
let req = Request {
290289
method: opts.method,
291-
url,
290+
url: opts.url,
292291
client: client.clone(),
293292
body,
294293
basic_auth,

0 commit comments

Comments
 (0)