Remove net from dependencies

This commit is contained in:
2shiori17 2023-03-20 22:12:50 +09:00
parent 68472fabf8
commit 74ecc2bd64
6 changed files with 30 additions and 20 deletions

View file

@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use headers::HeaderMap;
/// <https://fetch.spec.whatwg.org/#concept-header-list-get>
pub fn get_value_from_header_list(name: &str, headers: &HeaderMap) -> Option<String> {
let values = headers
.get_all(name)
.iter()
.map(|val| val.to_str().unwrap());
// Step 1
if values.size_hint() == (0, Some(0)) {
return None;
}
// Step 2
return Some(values.collect::<Vec<&str>>().join(", "));
}