Skip to content

Commit

Permalink
remove shrink to fit
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Feb 17, 2024
1 parent 581420f commit d3d2c77
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/http-signatures/src/cavage/signature_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ where
I: Iterator<Item = &'a str> + Clone,
{
let header_names = signature_header.headers.clone().collect::<Vec<&str>>();
let fulfills_min_requirements = match *request.method() {
let fulfils_min_requirements = match *request.method() {
Method::GET => is_subset(REQUIRED_GET_HEADERS, &header_names),
Method::POST => is_subset(REQUIRED_POST_HEADERS, &header_names),
_ => return Err(Error::InvalidMethod),
};

if !fulfills_min_requirements {
if !fulfils_min_requirements {
return Err(Error::MissingHeaderNames);
}

let mut signature_string = String::new();

for name in header_names {
match name {
name @ "(request-target)" => {
Expand Down Expand Up @@ -83,8 +84,6 @@ where
}
}

signature_string.shrink_to_fit();

Ok(signature_string)
}

Expand Down

0 comments on commit d3d2c77

Please sign in to comment.