diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2022-02-02 13:04:26 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-02 13:04:26 +1100 |
commit | 26f5c223df26962f19ccc957d0507facc09c55c5 (patch) | |
tree | 2d12e824acefba3e35d8a117693a7b4a7f210cf3 /test_util/src/lib.rs | |
parent | 8176a4d1663529fb8aeebf7734c4994fa1d583f4 (diff) |
fix(lsp): properly display x-deno-warning with redirects (#13554)
Fixes: #13472
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r-- | test_util/src/lib.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index ce2527e40..f8872615c 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -676,6 +676,18 @@ async fn main_server( *res.status_mut() = StatusCode::FOUND; Ok(res) } + (_, "/x_deno_warning.js") => { + let mut res = Response::new(Body::empty()); + *res.status_mut() = StatusCode::MOVED_PERMANENTLY; + res + .headers_mut() + .insert("X-Deno-Warning", HeaderValue::from_static("foobar")); + res.headers_mut().insert( + "location", + HeaderValue::from_bytes(b"/x_deno_warning_redirect.js").unwrap(), + ); + Ok(res) + } (_, "/non_ascii_redirect") => { let mut res = Response::new(Body::empty()); *res.status_mut() = StatusCode::MOVED_PERMANENTLY; @@ -1322,16 +1334,6 @@ pub async fn run_all_servers() { fn custom_headers(p: &str, body: Vec<u8>) -> Response<Body> { let mut response = Response::new(Body::from(body)); - if p.ends_with("/x_deno_warning.js") { - response.headers_mut().insert( - "Content-Type", - HeaderValue::from_static("application/javascript"), - ); - response - .headers_mut() - .insert("X-Deno-Warning", HeaderValue::from_static("foobar")); - return response; - } if p.ends_with("/053_import_compression/brotli") { response .headers_mut() |