1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Config,
//! helping managing the configuration
use HashMap;
use crateProtoLocal;
use HeaderMap;
/// A HttpConfig, including headers and cookies.
/// # Example
/// ```
/// # #[path = "test_utils/mod.rs"]
/// # mod test_utils;
/// # use test_utils::data::Conf;
/// # use fav_core::config::HttpConfig;
/// # use reqwest::{header::HeaderMap, header};
/// # use std::collections::HashMap;
///
/// impl HttpConfig for Conf {
/// fn headers(&self) -> HeaderMap {
/// let mut hp = HeaderMap::new();
/// hp.insert(header::USER_AGENT, self.headers.user_agent.parse().unwrap());
/// hp
/// }
///
/// fn cookies(&self) -> &HashMap<String, String> {
/// &self.headers.cookies
/// }
///
/// fn set_cookies(&mut self, cookies: HashMap<String, String>) {
/// self.headers.as_mut().unwrap().cookies = cookies;
/// }
/// }
/// ```
/// Mark it able to be a config, which concludes [`HttpConfig`], and can be persisted as protobuf through [`ProtoLocal`].