summaryrefslogtreecommitdiff
path: root/test_util/src
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-12-09 22:16:17 +1100
committerGitHub <noreply@github.com>2021-12-09 22:16:17 +1100
commit2347e60934a8701bb5f0ecba6a460447eab868c6 (patch)
tree9f857060a2d1c4a0536557ac3f0fad89b3d07ece /test_util/src
parent69ad5f0e7879e9555f949c9b5eb48440cd9e9fdc (diff)
feat(lsp): registry suggestion cache respects cache headers (#13010)
Fixes #9931
Diffstat (limited to 'test_util/src')
-rw-r--r--test_util/src/lib.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index 3cae1d7e1..4ad6f1c3c 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -893,6 +893,25 @@ async fn main_server(
);
Ok(res)
}
+ (_, "/dynamic") => {
+ let mut res = Response::new(Body::from(
+ serde_json::to_string_pretty(&std::time::SystemTime::now()).unwrap(),
+ ));
+ res
+ .headers_mut()
+ .insert("cache-control", HeaderValue::from_static("no-cache"));
+ Ok(res)
+ }
+ (_, "/dynamic_cache") => {
+ let mut res = Response::new(Body::from(
+ serde_json::to_string_pretty(&std::time::SystemTime::now()).unwrap(),
+ ));
+ res.headers_mut().insert(
+ "cache-control",
+ HeaderValue::from_static("public, max-age=604800, immutable"),
+ );
+ Ok(res)
+ }
_ => {
let mut file_path = testdata_path();
file_path.push(&req.uri().path()[1..]);