mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-25 20:12:14 +03:00
Create ClientOptions from RunnerOptions
This commit is contained in:
parent
58b89bced3
commit
e2689699c3
@ -19,6 +19,7 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use crate::cli::Logger;
|
use crate::cli::Logger;
|
||||||
use crate::http;
|
use crate::http;
|
||||||
|
use crate::http::ClientOptions;
|
||||||
use hurl_core::ast::*;
|
use hurl_core::ast::*;
|
||||||
|
|
||||||
use super::core::*;
|
use super::core::*;
|
||||||
@ -54,25 +55,7 @@ pub fn run(
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let client_options = http::ClientOptions::from(runner_options);
|
||||||
let client_options = http::ClientOptions {
|
|
||||||
cacert_file: runner_options.cacert_file.clone(),
|
|
||||||
follow_location: runner_options.follow_location,
|
|
||||||
max_redirect: runner_options.max_redirect,
|
|
||||||
cookie_input_file: runner_options.cookie_input_file.clone(),
|
|
||||||
proxy: runner_options.proxy.clone(),
|
|
||||||
no_proxy: runner_options.no_proxy.clone(),
|
|
||||||
verbosity: runner_options.verbosity.as_ref().map(|v| match v {
|
|
||||||
Verbosity::Verbose => http::Verbosity::Verbose,
|
|
||||||
Verbosity::VeryVerbose => http::Verbosity::VeryVerbose,
|
|
||||||
}),
|
|
||||||
insecure: runner_options.insecure,
|
|
||||||
timeout: runner_options.timeout,
|
|
||||||
connect_timeout: runner_options.connect_timeout,
|
|
||||||
user: runner_options.user.clone(),
|
|
||||||
user_agent: runner_options.user_agent.clone(),
|
|
||||||
compressed: runner_options.compressed,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Experimental features
|
// Experimental features
|
||||||
// with cookie storage
|
// with cookie storage
|
||||||
@ -207,6 +190,29 @@ pub fn run(
|
|||||||
entry_results
|
entry_results
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&RunnerOptions> for ClientOptions {
|
||||||
|
fn from(runner_options: &RunnerOptions) -> Self {
|
||||||
|
ClientOptions {
|
||||||
|
cacert_file: runner_options.cacert_file.clone(),
|
||||||
|
follow_location: runner_options.follow_location,
|
||||||
|
max_redirect: runner_options.max_redirect,
|
||||||
|
cookie_input_file: runner_options.cookie_input_file.clone(),
|
||||||
|
proxy: runner_options.proxy.clone(),
|
||||||
|
no_proxy: runner_options.no_proxy.clone(),
|
||||||
|
verbosity: runner_options.verbosity.as_ref().map(|v| match v {
|
||||||
|
Verbosity::Verbose => http::Verbosity::Verbose,
|
||||||
|
Verbosity::VeryVerbose => http::Verbosity::VeryVerbose,
|
||||||
|
}),
|
||||||
|
insecure: runner_options.insecure,
|
||||||
|
timeout: runner_options.timeout,
|
||||||
|
connect_timeout: runner_options.connect_timeout,
|
||||||
|
user: runner_options.user.clone(),
|
||||||
|
user_agent: runner_options.user_agent.clone(),
|
||||||
|
compressed: runner_options.compressed,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Logs this HTTP `request` spec.
|
/// Logs this HTTP `request` spec.
|
||||||
fn log_request_spec(request: &http::RequestSpec, logger: &Logger) {
|
fn log_request_spec(request: &http::RequestSpec, logger: &Logger) {
|
||||||
logger.debug_important("Request:");
|
logger.debug_important("Request:");
|
||||||
|
Loading…
Reference in New Issue
Block a user