2277: fix(http): fix panic when sending document update without content type header r=MarinPostma a=MarinPostma

I found a panic when pushing documents without a content-type. This fixes is by returning unknown instead of crashing.


Co-authored-by: ad hoc <postma.marin@protonmail.com>
This commit is contained in:
bors[bot] 2022-04-05 12:07:17 +00:00 committed by GitHub
commit 7f7958f815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -535,7 +535,7 @@ impl DocumentsAggregator {
.headers() .headers()
.get(CONTENT_TYPE) .get(CONTENT_TYPE)
.map(|s| s.to_str().unwrap_or("unkown")) .map(|s| s.to_str().unwrap_or("unkown"))
.unwrap() .unwrap_or("unkown")
.to_string(); .to_string();
ret.content_types.insert(content_type); ret.content_types.insert(content_type);
ret.index_creation = index_creation; ret.index_creation = index_creation;