Skip to content

Commit

Permalink
fix: missing default arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jobs62 committed Mar 18, 2024
1 parent dc0aac6 commit 78de4a1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct Config {
domain_filters: Vec<String>,
#[serde(default)]
allow_invalid_certs: bool,
#[serde(deserialize_with = "deserialize_certificate")]
#[serde(deserialize_with = "deserialize_certificate", default)]
certificate_bundle: Vec<reqwest::Certificate>,
}

Expand Down Expand Up @@ -112,9 +112,11 @@ fn deserialize_certificate<'de, D>(deserializer: D) -> Result<Vec<reqwest::Certi
where
D: Deserializer<'de>,
{
Ok(match Option::deserialize(deserializer)? {
Ok(match Option::<String>::deserialize(deserializer)? {
None => Vec::new(),
Some(b) => reqwest::Certificate::from_pem_bundle(b).map_err(de::Error::custom)?,
Some(b) => {
reqwest::Certificate::from_pem_bundle(b.as_bytes()).map_err(de::Error::custom)?
}
})
}

Expand Down

0 comments on commit 78de4a1

Please sign in to comment.