summaryrefslogtreecommitdiff
path: root/test_util/src
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2021-05-13 08:07:22 +0900
committerGitHub <noreply@github.com>2021-05-13 08:07:22 +0900
commite8a7f237de30a8291f97e318ba79382b65a8d228 (patch)
tree296ab382a42ff499c41ac6d68f9ee19b1bda3bbd /test_util/src
parentea83f18f9009a9201b876a1fbe006e194116bd8d (diff)
fix(cli): ignore x-typescript-types header when media type is not js/jsx (#10574)
Diffstat (limited to 'test_util/src')
-rw-r--r--test_util/src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index 31aa07177..d2669e42e 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -497,6 +497,30 @@ async fn main_server(req: Request<Body>) -> hyper::Result<Response<Body>> {
);
Ok(res)
}
+ (_, "/xTypeScriptTypes.jsx") => {
+ let mut res = Response::new(Body::from("export const foo = 'foo';"));
+ res
+ .headers_mut()
+ .insert("Content-type", HeaderValue::from_static("text/jsx"));
+ res.headers_mut().insert(
+ "X-TypeScript-Types",
+ HeaderValue::from_static("./xTypeScriptTypes.d.ts"),
+ );
+ Ok(res)
+ }
+ (_, "/xTypeScriptTypes.ts") => {
+ let mut res =
+ Response::new(Body::from("export const foo: string = 'foo';"));
+ res.headers_mut().insert(
+ "Content-type",
+ HeaderValue::from_static("application/typescript"),
+ );
+ res.headers_mut().insert(
+ "X-TypeScript-Types",
+ HeaderValue::from_static("./xTypeScriptTypes.d.ts"),
+ );
+ Ok(res)
+ }
(_, "/xTypeScriptTypes.d.ts") => {
let mut res = Response::new(Body::from("export const foo: 'foo';"));
res.headers_mut().insert(