pub struct HttpConfig {
pub method: String,
pub url: String,
pub headers: Vec<(String, String)>,
pub body: Option<Value>,
pub timeout_secs: Option<u64>,
pub allow_failure: bool,
}Expand description
Serializable configuration for an HTTP step.
§Examples
use ironflow_engine::config::HttpConfig;
let config = HttpConfig::get("https://api.example.com/health");Fields§
§method: StringHTTP method (GET, POST, PUT, PATCH, DELETE).
url: StringRequest URL.
headers: Vec<(String, String)>Request headers.
body: Option<Value>Request body as JSON.
timeout_secs: Option<u64>Timeout in seconds (default: 30).
allow_failure: boolWhen true, a failure of this step does not fail the run.
Implementations§
Source§impl HttpConfig
impl HttpConfig
Sourcepub fn get(url: &str) -> Self
pub fn get(url: &str) -> Self
Create a GET request config.
§Examples
use ironflow_engine::config::HttpConfig;
let config = HttpConfig::get("https://example.com");
assert_eq!(config.method, "GET");Sourcepub fn timeout_secs(self, secs: u64) -> Self
pub fn timeout_secs(self, secs: u64) -> Self
Set the timeout in seconds.
Sourcepub fn allow_failure(self) -> Self
pub fn allow_failure(self) -> Self
Mark this step as allowed to fail without stopping the run.
§Examples
use ironflow_engine::config::HttpConfig;
let config = HttpConfig::get("https://example.com").allow_failure();
assert!(config.allow_failure);Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpConfig
impl Debug for HttpConfig
Source§impl<'de> Deserialize<'de> for HttpConfig
impl<'de> Deserialize<'de> for HttpConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<HttpConfig> for StepConfig
impl From<HttpConfig> for StepConfig
Source§fn from(c: HttpConfig) -> Self
fn from(c: HttpConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HttpConfig
impl RefUnwindSafe for HttpConfig
impl Send for HttpConfig
impl Sync for HttpConfig
impl Unpin for HttpConfig
impl UnsafeUnpin for HttpConfig
impl UnwindSafe for HttpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more