You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running tests with a {{host}} variable missing a protocol panics.
Steps to reproduce
# Reproducing requires some type of server running at localhost:4000echo"GET {{host}}"> test.hurl
hurl --variable host=localhost:4000 test.hurl
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hurl-4.0.0/src/http/request.rs:74:24
stack backtrace:
0: rust_begin_unwind
at /rustc/7908a1d65496b88626e4b7c193c81d777005d6f3/library/std/src/panicking.rs:578:5
1: core::panicking::panic_fmt
at /rustc/7908a1d65496b88626e4b7c193c81d777005d6f3/library/core/src/panicking.rs:67:14
2: core::panicking::panic
at /rustc/7908a1d65496b88626e4b7c193c81d777005d6f3/library/core/src/panicking.rs:117:5
3: hurl::http::request::Request::base_url
4: hurl::http::client::Client::execute_with_redirect
5: hurl::runner::entry::run
6: hurl::runner::hurl_file::run
7: hurl::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
What is the expected correct behavior?
An error message. Something like "Invalid URL" or "URLs must have a protocol."
Execution context
Hurl Version: 4.0.0
Operating system and version: Void Linux, Kernel 6.1
Possible fixes
diff --git a/packages/hurl/src/http/request.rs b/packages/hurl/src/http/request.rs
index 7737fe8d..9a77b090 100644
--- a/packages/hurl/src/http/request.rs+++ b/packages/hurl/src/http/request.rs@@ -71,7 +71,7 @@ impl Request {
let base_url = format!(
"{}://{}{}",
url.scheme(),
- url.host().unwrap(),+ url.host().ok_or_else(|| HttpError::InvalidUrl(self.url.clone()))?,
if let Some(port) = url.port() {
format!(":{port}")
} else {
The text was updated successfully, but these errors were encountered:
What is the current bug behavior?
Running tests with a {{host}} variable missing a protocol panics.
Steps to reproduce
What is the expected correct behavior?
An error message. Something like "Invalid URL" or "URLs must have a protocol."
Execution context
Possible fixes
The text was updated successfully, but these errors were encountered: