Skip to content

Commit 3899227

Browse files
committed
fix: avoid panic when translating from hyperium
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.
1 parent dc6367c commit 3899227

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/hyperium_http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn hyperium_headers_to_headers(hyperium_headers: http::HeaderMap, headers: &mut
6161
if let Some(name) = name {
6262
let name = name.as_str().as_bytes().to_owned();
6363
let name = unsafe { HeaderName::from_bytes_unchecked(name) };
64-
headers.insert(name, value).unwrap();
64+
headers.append(name, value);
6565
}
6666
}
6767
}

0 commit comments

Comments
 (0)