Expose method to take missing headers from RequiredError

This commit is contained in:
Aode (lion) 2021-09-17 19:32:45 -05:00
parent 9aa7874f24
commit f641335dfd
2 changed files with 14 additions and 2 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "http-signature-normalization"
description = "An HTTP Signatures library that leaves the signing to you"
version = "0.5.3"
version = "0.5.4"
authors = ["asonix <asonix@asonix.dog>"]
license-file = "LICENSE"
readme = "README.md"
@ -16,7 +16,7 @@ members = [
"http-signature-normalization-actix",
"http-signature-normalization-http",
"http-signature-normalization-reqwest",
"http-signature-normalization-warp",
# "http-signature-normalization-warp",
]
[dependencies]

View file

@ -99,6 +99,18 @@ pub enum PrepareVerifyError {
/// Failed to build a signing string due to missing required headers
pub struct RequiredError(HashSet<String>);
impl RequiredError {
/// Retrieve the missing headers from the error
pub fn headers(&self) -> &HashSet<String> {
&self.0
}
/// Take the headers from the error
pub fn take_headers(&mut self) -> HashSet<String> {
std::mem::take(&mut self.0)
}
}
impl Config {
/// Create a new Config with a default expiration of 10 seconds
pub fn new() -> Self {