diff options
author | Maayan Hanin <maayan.asa.hanin@gmail.com> | 2020-08-04 00:39:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 23:39:48 +0200 |
commit | 5fc5e7b54a9fba421dfc473016625a4f592403ed (patch) | |
tree | e66bbbdaa30b34b7cef8072ded8ea3f0575c47f0 /test_util/src/lib.rs | |
parent | d615ebefe2e306f2877afb40dc603f71263407d6 (diff) |
fix(cli): add support for non-UTF8 source files (#6789)
Fixes: #5542
Diffstat (limited to 'test_util/src/lib.rs')
-rw-r--r-- | test_util/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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<dyn Reply> { 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") |