summaryrefslogtreecommitdiff
path: root/cli/http_cache.rs
diff options
context:
space:
mode:
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);
}