mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-22 01:11:00 +00:00
Expose method to take missing headers from RequiredError
This commit is contained in:
parent
9aa7874f24
commit
f641335dfd
2 changed files with 14 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "http-signature-normalization"
|
name = "http-signature-normalization"
|
||||||
description = "An HTTP Signatures library that leaves the signing to you"
|
description = "An HTTP Signatures library that leaves the signing to you"
|
||||||
version = "0.5.3"
|
version = "0.5.4"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license-file = "LICENSE"
|
license-file = "LICENSE"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -16,7 +16,7 @@ members = [
|
||||||
"http-signature-normalization-actix",
|
"http-signature-normalization-actix",
|
||||||
"http-signature-normalization-http",
|
"http-signature-normalization-http",
|
||||||
"http-signature-normalization-reqwest",
|
"http-signature-normalization-reqwest",
|
||||||
"http-signature-normalization-warp",
|
# "http-signature-normalization-warp",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -99,6 +99,18 @@ pub enum PrepareVerifyError {
|
||||||
/// Failed to build a signing string due to missing required headers
|
/// Failed to build a signing string due to missing required headers
|
||||||
pub struct RequiredError(HashSet<String>);
|
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 {
|
impl Config {
|
||||||
/// Create a new Config with a default expiration of 10 seconds
|
/// Create a new Config with a default expiration of 10 seconds
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
|
Loading…
Reference in a new issue