fix: reset MIME type if passed to set_file value is None

This commit is contained in:
link2xt
2023-07-14 04:28:21 +00:00
parent ab1c7ebbe2
commit 1ba69dbb9b
2 changed files with 13 additions and 8 deletions

View File

@@ -281,6 +281,16 @@ impl Params {
self
}
/// Sets the given key from an optional value.
/// Removes the key if the value is `None`.
pub fn set_optional(&mut self, key: Param, value: Option<impl ToString>) -> &mut Self {
if let Some(value) = value {
self.set(key, value)
} else {
self.remove(key)
}
}
/// Check if there are any values in this.
pub fn is_empty(&self) -> bool {
self.inner.is_empty()