From 5fc5e7b54a9fba421dfc473016625a4f592403ed Mon Sep 17 00:00:00 2001 From: Maayan Hanin Date: Tue, 4 Aug 2020 00:39:48 +0300 Subject: fix(cli): add support for non-UTF8 source files (#6789) Fixes: #5542 --- test_util/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test_util/src') diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 7c754e02d..a6fb74914 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -430,6 +430,19 @@ fn custom_headers(path: warp::path::Peek, f: warp::fs::File) -> Box { let f = with_header(f, "Content-Length", "39"); return Box::new(f); } + if p.contains("cli/tests/encoding/") { + let charset = p + .split_terminator('/') + .last() + .unwrap() + .trim_end_matches(".ts"); + let f = with_header( + f, + "Content-Type", + &format!("application/typescript;charset={}", charset)[..], + ); + return Box::new(f); + } let content_type = if p.contains(".t1.") { Some("text/typescript") -- cgit v1.2.3