summaryrefslogtreecommitdiff
path: root/cli/http_cache.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-09-16 13:34:16 +0200
committerGitHub <noreply@github.com>2020-09-16 13:34:16 +0200
commitd4a24c870e87b55dab425bc2c320aa88a6224030 (patch)
treee4ab9c88251166c711a03ad305f4d2b48f8369b1 /cli/http_cache.rs
parentaa657d6493cb0f36a5e2aa29e6352c9a9991ad2b (diff)
Revert "fix(cli/http_utils): accept a single key-multiple values headers (#7375)" (#7515)
This reverts commit f5c84920c225579af9c249bdac4a59a046ef8683.
Diffstat (limited to 'cli/http_cache.rs')
-rw-r--r--cli/http_cache.rs25
1 files changed, 7 insertions, 18 deletions
diff --git a/cli/http_cache.rs b/cli/http_cache.rs
index d14f3d2ad..6b2465b38 100644
--- a/cli/http_cache.rs
+++ b/cli/http_cache.rs
@@ -215,14 +215,11 @@ mod tests {
let cache = HttpCache::new(dir.path());
let url = Url::parse("https://deno.land/x/welcome.ts").unwrap();
let mut headers = HashMap::new();
- headers
- .entry("content-type".to_string())
- .or_insert_with(Vec::new)
- .push("application/javascript".to_string());
- headers
- .entry("etag".to_string())
- .or_insert_with(Vec::new)
- .push("as5625rqdsfb".to_string());
+ headers.insert(
+ "content-type".to_string(),
+ "application/javascript".to_string(),
+ );
+ headers.insert("etag".to_string(), "as5625rqdsfb".to_string());
let content = b"Hello world";
let r = cache.set(&url, headers, content);
eprintln!("result {:?}", r);
@@ -234,18 +231,10 @@ mod tests {
file.read_to_string(&mut content).unwrap();
assert_eq!(content, "Hello world");
assert_eq!(
- headers
- .get("content-type")
- .unwrap()
- .first()
- .unwrap()
- .as_str(),
+ headers.get("content-type").unwrap(),
"application/javascript"
);
- assert_eq!(
- headers.get("etag").unwrap().first().unwrap().as_str(),
- "as5625rqdsfb"
- );
+ assert_eq!(headers.get("etag").unwrap(), "as5625rqdsfb");
assert_eq!(headers.get("foobar"), None);
}