Skip to content

Commit

Permalink
Add unit test of repeated headers for aggregate_raw_headers
Browse files Browse the repository at this point in the history
  • Loading branch information
theoforger committed Dec 6, 2024
1 parent 983779f commit 31a0bbf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/hurl/src/http/headers_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ mod tests {
let mut headers = HeaderVec::new();
headers.push(Header::new("Host", "localhost:8000"));

let raw_headers = &["User-Agent: hurl/6.1.0", "Invalid-Header"];
let raw_headers = &[
"User-Agent: hurl/6.1.0",
"Invalid-Header",
"Repeated-Header: content-1",
"Repeated-Header: content-2",
];
let aggregated = headers.aggregate_raw_headers(raw_headers);

assert_eq!(
Expand All @@ -136,5 +141,12 @@ mod tests {
Some(&Header::new("User-Agent", "hurl/6.1.0"))
);
assert_eq!(aggregated.get("Invalid-Header"), None);
assert_eq!(
aggregated.get_all("Repeated-Header"),
vec![
&Header::new("Repeated-Header", "content-1"),
&Header::new("Repeated-Header", "content-2")
]
);
}
}

0 comments on commit 31a0bbf

Please sign in to comment.