Skip to content

Commit

Permalink
fix: avoid panic when translating from hyperium
Browse files Browse the repository at this point in the history
Before it always paniced on new headers while trying to blankly unwrap
the return of a hashmap insert.

This makes it:
  a. no longer unwrap at all, which was incorrect, and
  b. use append for duplicates

The opposite direction also uses hyperium's append, but (I think) this
was written before that same functionality existed in http-types.
  • Loading branch information
Fishrock123 committed Apr 27, 2021
1 parent dc6367c commit 3899227
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hyperium_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn hyperium_headers_to_headers(hyperium_headers: http::HeaderMap, headers: &mut
if let Some(name) = name {
let name = name.as_str().as_bytes().to_owned();
let name = unsafe { HeaderName::from_bytes_unchecked(name) };
headers.insert(name, value).unwrap();
headers.append(name, value);
}
}
}
Expand Down

0 comments on commit 3899227

Please sign in to comment.