pub struct HttpConfig {
pub url: String,
pub authorization: Option<String>,
pub base_timeout: Duration,
pub modem_timeout: Option<Duration>,
}
Expand description
HTTP-specific configuration.
Fields§
§url: String
HTTP base URL. eg: http://192.168.1.2:3000
Optional HTTP authorization header token.
base_timeout: Duration
A default timeout to apply to all requests that do not have their own timeout (this applies to all if modem_timeout is None, otherwise only database and sys queries).
modem_timeout: Option<Duration>
An optional timeout to use specifically for modem requests (requests that must send and receive modem data). This should be higher than the default timeout as they can take longer.
Implementations§
Source§impl HttpConfig
impl HttpConfig
Sourcepub const HTTP_DEFAULT_BASE_TIMEOUT: u64 = 5u64
pub const HTTP_DEFAULT_BASE_TIMEOUT: u64 = 5u64
The default amount of seconds before an HTTP request should time out. If there is no modem_timeout, this is applied to all requests.
Sourcepub const HTTP_DEFAULT_MODEM_TIMEOUT: u64 = 20u64
pub const HTTP_DEFAULT_MODEM_TIMEOUT: u64 = 20u64
The default amount of seconds before an HTTP request that interacts directly with the modem should time out. This should be longer to allow for carrier response.
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Create a new HTTP configuration with default settings.
Sourcepub fn with_base_timeout(self, timeout: Duration) -> Self
pub fn with_base_timeout(self, timeout: Duration) -> Self
Set the base request timeout.
Sourcepub fn with_modem_timeout(self, timeout: Option<Duration>) -> Self
pub fn with_modem_timeout(self, timeout: Option<Duration>) -> Self
Set the modem request timeout.
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more